How to use a background command in an if statement?
Here is a minimum step to reproduce:
$ if [[ $(uname -s ) == Linux ]] ; then gedit & ; fi
bash: syntax error near unexpected token `;'
CodePudding user response:
When using &
you don't need the ;
anymore.
if [[ $(uname -s ) == Linux ]] ; then gedit & fi