oh-my-bash
oh-my-bash copied to clipboard
Terminal starts with error after changing theme
I changed the theme to cupcake and restarted the terminal.
It always starts with an error:
bash: command substitution: line 1: syntax error near unexpected token `)'
bash: command substitution: line 1: `[[ -n $(git branch 2> /dev/null) ]] && echo " on 🌿
")'
The previous theme was purity and I didn't have such problems wit it. It is just when I changed the theme that this problem started.
Same here from me, this is happening to me in git-bash on windows.
Similar here:
I get the following whenever I source .bashrc :
bash: /home/solrevdev/.oh-my-bash/lib/base.sh: line 209: syntax error near unexpected token `('
bash: /home/solrevdev/.oh-my-bash/lib/base.sh: line 209: ` myip () {'
Where line 207-212 of bash.sh is
# myip: displays your ip address, as seen by the Internet
# -------------------------------------------------------------------
myip () {
res=$(curl -s checkip.dyndns.org | grep -Eo '[0-9\.]+')
echo -e "Your public IP is: ${echo_bold_green} $res ${echo_normal}"
}
System info:
neofetch --off
solrevdev@hplaptop
------------------
OS: Ubuntu 20.04.4 LTS x86_64
Host: HP 250 G6 Notebook PC
Kernel: 5.4.0-124-generic
Uptime: 7 hours, 5 mins
Packages: 3751 (dpkg), 1 (pkg), 30 (flatpak), 35 (snap)
Shell: bash 5.0.17
Resolution: 1920x1080
DE: GNOME
WM: Mutter
WM Theme: Adwaita
Theme: Yaru [GTK2/3]
Icons: Yaru [GTK2/3]
Terminal: terminator
CPU: Intel i5-7200U (4) @ 3.100GHz
GPU: Intel HD Graphics 620
Memory: 8221MiB / 15926MiB
@solrevdev The message is the same, but I think the actual problem is different from the original one. In your case, I think the shell function myip defined in oh-my-bash is conflicting with an alias myip defined outside of oh-my-bash. Do you define a custom alias myip?
@solrevdev The message is the same, but I think the actual problem is different from the original one. In your case, I think the shell function
myipdefined in oh-my-bash is conflicting with an aliasmyipdefined outside of oh-my-bash. Do you define a custom aliasmyip?
That’s it! Thanks @akinomyoga ! That was exactly the issue there was another function named that which I could comment out and bingo!
I have checked the original issue of cupcake. It seems to be a problem specific to Git Bash (aka Git for Windows). I confirmed the problem in Git Bash 2.31.1 and found that the error even happens without Oh My Bash but with the following simple setting:
PS1='$(echo hello)\n'
This seems to be the same problem as discussed here. According to this page, Git Bash 2.6.3 and 2.8.2 seems to have had the same problem.
The problem doesn't seem to reproduce in the upstream Cygwin and also in Linux. I have updated Git Bash to 2.37.2 and found that the problem is fixed there. So the solution is just to update Git for Windows:
Solution
The problem is fixed in the latest version of Git for Windows (Git Bash). Please update your Git for Windows:
$ git update-git-for-windows