1
1
I have bash function of:
myworkhomebrewapp(){ atom $HOMEBREW_FRONTEND; atom $HOMEBREW_BACKEND; workon homebrew_server; cd $HOMEBREW_BACKEND; python manage.py runserver & ; /usr/bin/open -a "/Applications/Google Chrome.app" "file:///Users/cchilders/projects/good_brews/frontend/index.html" ;}
But it causes error
$ src
-bash: /Users/cchilders/.bash_profile: line 63: syntax error near unexpected token `;'
-bash: /Users/cchilders/.bash_profile: line 63: `myworkhomebrewapp(){ atom $HOMEBREW_FRONTEND; atom $HOMEBREW_BACKEND; workon homebrew_server; cd $HOMEBREW_BACKEND; python manage.py runserver & ; /usr/bin/open -a "/Applications/Google Chrome.app" "file:///Users/cchilders/projects/good_brews/frontend/index.html" ;}'
I don't know what causes error, but commenting that line out fixes it. Where is my bash function broken please? Thank you
One solution:
I was able to fix the issue by splitting new lines in my .bashrc, which isn't what I wanted:
myworkhomebrewapp(){
atom $HOMEBREW_FRONTEND
atom $HOMEBREW_BACKEND
workon homebrew_server
cd $HOMEBREW_BACKEND
python manage.py runserver &
sleep 5
/usr/bin/open -a "/Applications/Google Chrome.app" "file://$HOMEBREW_FRONTEND/index.html"
}
2It's the semicolon after the ampersand that is causing the error (pity that
bash
doesn't report the column as well as the line number): blank statements are not allowed. You can separate statements by either;
or&
(as well as other separators), but not both. Just typing;
intobash
gives the same error. – AFH – 2016-12-15T01:07:55.403