bash语法错误报告格式(基本)
对于 shell 脚本来说是新手,我注意到意外标记的语法错误报告的格式为
`unexpectedtoken' # ie backtick unexpected_token singlequote
What do the backtick and the single quote indicates?它们不存在于脚本本身中。 它们与外壳有关,但是什么呢?
更具体地说,我目前从同一行收到两个错误报告,这应该有助于我的调试尝试,但我不知道如何解释它们。该脚本有一个参数传递给函数。
append2file \
"(common params for all samples; exemplar: ${monoArr2[@]:(-1)})"
参数行(第 154 行)上的第一个括号是意外标记。这还会触发第二个错误报告。
./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)})" \'
前导反引号和双引号字符串开头之间的间距一定告诉我一些有助于我调试的信息,但是什么??? TIA
M
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
定义函数的语法是:
听起来你在 () 里面放了一些东西。不要那样做。
The syntax for defining a function is:
It sounds like you are putting something inside the (). Don't do that.