答案1
bash: syntax error near unexpected token '('
你需要逃脱括号内为:
mv hiscore\(pre_mame0133u1\).dat /mnt/three/usr/local/share/xmame/hiscore.dat
笔记:
供将来参考,您可以使用壳牌检测查找 Bash 代码中的错误。输入未更正的脚本将得到以下内容:
$ shellcheck myscript
Line 1:
mv hiscore(pre_mame0133u1).dat /mnt/three/usr/local/share/xmame/hiscore.dat
^-- SC2148: Tips depend on target shell and yours is unknown. Add a shebang.
^-- SC1036: '(' is invalid here. Did you forget to escape it?
^-- SC1088: Parsing stopped here. Invalid use of parentheses?
纠正第一个错误:
$ shellcheck myscript
Line 1:
mv hiscore\(pre_mame0133u1).dat /mnt/three/usr/local/share/xmame/hiscore.dat
^-- SC2148: Tips depend on target shell and yours is unknown. Add a shebang.
^-- SC1089: Parsing stopped here. Is this keyword correctly matched up?
纠正第二个错误:
$ shellcheck myscript
Line 1:
mv hiscore\(pre_mame0133u1\).dat /mnt/three/usr/local/share/xmame/hiscore.dat
^-- SC2148: Tips depend on target shell and yours is unknown. Add a shebang.
进一步阅读
- Linux 的 Bash 命令行的 AZ 索引- 与 Bash 命令行相关的所有事物的绝佳参考。
- 语法引用- 转义符、分隔符和引号