Newish to shell scripting I’ve noticed that the syntax error report for an unexpected token has the format
`unexpectedtoken' # ie backtick unexpected_token singlequote
What do the backtick and the single quote represent? They’re not present in the script itself.
They’re something to do with the shell, but what?
More specifically, I’m currently getting two error reports from the same line, which should be helping my debug attempts but I don’t know how to interpret them. The script has a param being passed to a function.
append2file \
"(common params for all samples; exemplar: ${monoArr2[@]:(-1)})"
The first paren on the param line (line154) is the unexpected token. This also triggers a second error report.
./process_v7.sh: line 154: syntax error near unexpected token `('
./process_v7.sh: line 154: ` "(common params for all read_2 samples; exemplar: ${monoArr2[@]:(-1)})" \'
The spacing between the leading backtick and the start of that double-quoted string must be telling me something that will help my debugging, but what??? TIA
M
The syntax for defining a function is:
append2file() { # some code that references parameters via $1, $*, $@, etc }It sounds like you are putting something inside the (). Don’t do that.