Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git Bash: Terminal starts with error after changing theme #211

Closed
gitwikc opened this issue Mar 31, 2021 · 5 comments
Closed

Git Bash: Terminal starts with error after changing theme #211

gitwikc opened this issue Mar 31, 2021 · 5 comments
Labels

Comments

@gitwikc
Copy link

gitwikc commented Mar 31, 2021

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.

@johnsonjo4531
Copy link

Same here from me, this is happening to me in git-bash on windows.

@solrevdev
Copy link

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 

@akinomyoga
Copy link
Contributor

@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
Copy link

solrevdev commented Aug 17, 2022

@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?

That’s it! Thanks @akinomyoga ! That was exactly the issue there was another function named that which I could comment out and bingo!

@akinomyoga
Copy link
Contributor

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

@akinomyoga akinomyoga changed the title Terminal starts with error after changing theme Git Bash: Terminal starts with error after changing theme Aug 18, 2022
@akinomyoga akinomyoga mentioned this issue Aug 18, 2022
42 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants