text: Q:
  
  Syntax error in .bashrc after installing gsutil
  
  On a Linux machine, I'm trying to install gsutil following the instructions on https://cloud.google.com/storage/docs/gsutil_install. During installation, I answered "yes" to everything and left things at their default values.
  Now however, if I open a new terminal it starts with a bash error:
  bash: /home/kurt/.bashrc: line 119: syntax error near unexpected token `fi'
  bash: /home/kurt/.bashrc: line 119: `fi'
  kurt@kurt-ThinkPad:~$
  
  The offending lines are contained in the following snippet of my .bashrc file:
  # enable programmable completion features (you don't need to enable
  # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
  # sources /etc/bash.bashrc).
  if ! shopt -oq posix; then
    if [ -f /usr/share/bash-completion/bash_completion ]; then
      . /usr/share/bash-completion/bash_completion
    elif [ -f /etc/bash_completion ]; then
      . /etc/bash_completion
    fi
  fi
    source '/home/kurt/Downloads/google-cloud-sdk/path.bash.inc'
  fi
    source '/home/kurt/Downloads/google-cloud-sdk/completion.bash.inc'
  fi
  
  The error occurs at the second-last fi statement. Indeed, it looks like the last two fis are not matched by any if. I could just comment out the last three lines, but I'm not sure if that would break the functionality. Any advice?
  
  A:
  
  From looking at your .bashrc snippet, you won’t break any functionality by removing the last two fi keywords.  It’s possible that there’s a corresponding if keyword earlier in the file but going by the indentation and content of the preceding block (configuring bash completion), I doubt it.
  I’d guess that the missing lines are checking that the two files exist (and are readable) before trying to source them:
  if [ -r '/home/kurt/Downloads/google-cloud-sdk/path.bash.inc' ]; then
    source '/home/kurt/Downloads/google-cloud-sdk/path.bash.inc'
  fi
  
  if [ -r '/home/kurt/Downloads/google-cloud-sdk/completion.bash.inc' ]; then
    source '/home/kurt/Downloads/google-cloud-sdk/completion.bash.inc'
  fi
  
  It looks like there is a bug in the installer that generated those lines. To be on the safe side, I would re-download the package and run the installer again.
  
  