如何解决第 131 行的语法错误:``'不匹配。'错误
我是剧本写作的新手。我遇到了标题中提到的问题,即“第 131 行语法错误:``' 不匹配。” 。第131行的代码被注释掉了。我认为下面的行可能会导致问题。谁能指导我如何编写下面的代码?我需要输出 scp 和 ssh 命令的值来确定代码是否成功执行。
scpstat=`echo scp $INPUTDIR/work_dir/$f $EUSER@$ESCSYS:$EDIR/build/. |
ssh $EUSER@$ECSYS "chmod 660 $EDIR/build/$f;chgrp 107 $EDIR/build/$f;chown 103 $ESCDIR/build/$f;rename $ESCDIR/build/$f $ESCDIR/work/$f"'
status=$?
I am new to script writing. I have encountered the mentioned in the title i.e 'Syntax error at line 131 : ``' is not matched.' . The code at line 131 is commented out. I think the line below might be causing the problem. Could anyone direct me how the code below should be written? I need to output the value of scp and ssh command to determine whether the code was succesfully executed.
scpstat=`echo scp $INPUTDIR/work_dir/$f $EUSER@$ESCSYS:$EDIR/build/. |
ssh $EUSER@$ECSYS "chmod 660 $EDIR/build/$f;chgrp 107 $EDIR/build/$f;chown 103 $ESCDIR/build/$f;rename $ESCDIR/build/$f $ESCDIR/work/$f"'
status=$?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
通常很难找到脚本错误中提到的行号。这是因为,如果您在脚本中包含另一个脚本(通过在 ksh 中指定 .scriptname 来完成),则原始脚本的实际长度会在运行时发生变化。如果包含的脚本中有错误,则行号可能会产生误导,因为您无法到达这些行。我觉得就您而言,错误是在被调用的脚本中,而不是您正在研究的脚本中。检查您是否正在调用/包含任何其他脚本并尝试单独运行它。这样您可能可以隔离问题。
It is often hard to reach the line numbers mentioned in the script errors. It is because if you include another script within your script (done by specifying . scriptname in ksh) then the actual length of the original script changes at runtime. If there are errors in the included script then line numbers could be misleading because you cannot reach those lines. I feel that the error, in your case, is in the called script and not the one you are looking into. Check if you are calling/including any other script and try running it separately. This way you probably can isolate the problem.
好吧,一开始你有一个开头`,但没有结尾。 :)
Well, to begin with you have an opening `, and you don't have a closing one. :)
在我看来,
echo
之前的 `(反引号)不匹配,正如错误所示。看起来第二行末尾的 ' (撇号)应该是反引号。有些人认为使用
$(...)
而不是 `...` 是更好的风格,这无疑是一个很好的例子。It looks to me like the ` (backtick) before
echo
is not matched, as the error suggests. It looks like the ' (apostrophe) at the end of the second line should be a backtick instead.Some people think it's better style to use
$(...)
rather than `...`, and this is surely a good example of why.