bash-git-prompt icon indicating copy to clipboard operation
bash-git-prompt copied to clipboard

error syntaxe ligne 18 of gitprompt.sh

Open rimoi opened this issue 6 years ago • 0 comments

Hello,

I have an error when I want to run source ~/.bashrc

sidi@sidi:~$ source ~/.bashrc
bash: /home/sidi/.bash-git-prompt/gitprompt.sh: ligne 18: 
syntax error near the unexpected symbol « done »
bash: /home/sidi/.bash-git-prompt/gitprompt.sh: ligne 18: `    done'
bash: /usr/share/bash-completion/bash_completion: ligne 213: 
syntax error near the unexpected symbol « done »
bash: /usr/share/bash-completion/bash_completion: ligne 213: `    done'

file gitprompt.sh :

function git_prompt_dir() {
  # assume the gitstatus.sh is in the same directory as this script
  # code thanks to http://stackoverflow.com/questions/59895
  if [[ -z "${__GIT_PROMPT_DIR:+x}" ]]; then
    local SOURCE="${BASH_SOURCE[0]}"
    while [[ -h "${SOURCE}" ]]; do
      local DIR="$( command cd -P "$( dirname "${SOURCE}" )" && pwd )"
      SOURCE="$(readlink "${SOURCE}")"
      [[ ${SOURCE} != /* ]] && SOURCE="${DIR}/${SOURCE}"
    done
    __GIT_PROMPT_DIR="$( command cd -P "$( dirname "${SOURCE}" )" && pwd )"
  fi
  
  # .....
}

file ~/.bashrc :

if [ -f "$HOME/.bash-git-prompt/gitprompt.sh" ]; then
    GIT_PROMPT_ONLY_IN_REPO=1
    source $HOME/.bash-git-prompt/gitprompt.sh
fi

If someone has an idea! Thanks

rimoi avatar May 29 '19 11:05 rimoi