-2
I have bash function:
WORKING_REACT_EXAMPLES="$HOME/tutorials/javascript/react/working-react-examples"
dualpush() { cd $WORKING_REACT_EXAMPLES; cmpushall "$1"; cd ..; cmpushall $1; cd $WORKING_REACT_EXAMPLES ;}
it looks similar to my other functions. When I try to source .bashrc I get
$ src
-bash: /Users/cchilders/.bash_profile: line 260: syntax error near unexpected token `('
-bash: /Users/cchilders/.bash_profile: line 260: `dualpush() { cd $WORKING_REACT_EXAMPLES; cmpushall "$1"; cd ..; cmpushall "$1"; cd $WORKING_REACT_EXAMPLES ;}'
Shellcheck warns to double quote something, yet doesn't say any errors, so I do
dualpush() { cd "$WORKING_REACT_EXAMPLES"; cmpushall "$1"; cd ..; cmpushall "$1"; cd "$WORKING_REACT_EXAMPLES" ;}
and get same error
What is causing the syntax error? Thank you
3The error message says "line 260". You only showed two lines. What does the rest of the file look like? – user1686 – 2017-01-31T07:17:57.740
the rest of the file isn't relevant to the problem, this is line 260. commenting this line out fixes the proble, so the issue is in this line. I added it all anyway – codyc4321 – 2017-01-31T14:26:58.653
2Seemingly bogus syntax errors are often caused by subtle syntax errors that precede them. There may be quite some distance between the point the parser gave up and the actual cause. – Daniel B – 2017-01-31T15:03:59.623
that's true, bash is tricky like that – codyc4321 – 2017-01-31T17:04:08.513