【发布时间】:2017-04-04 19:37:55
【问题描述】:
我得到的错误如下:
新窗口打开后,请按回车继续../config: line 82: syntax error near unexpected token newline'
./config: line 82:set reply=$
我在 bash shell 中。该脚本最初是为 csh 设计的。我已将脚本的第一行更改为 #!/bin/bash。
脚本应该打开一个新窗口来输入一些变量进行配置。 . . .
echo "use the word 'type' to indicate it is a command for the other window."
echo " "
echo -n "After the new window is open, please hit enter to go on."
set reply=$<
tput clear
我已经检查并知道 shell 是交互式的。我没有使用 sh ./config 执行,而是尝试使用 bash ./config ;仍然是同样的错误。如果我在 shell 中输入
【问题讨论】:
-
您引用的第 82 行中的反引号和单引号之间似乎有些混淆。此外,您不需要尖括号或
set来设置该变量。试试read REPLY;用户的输入将在$REPLY中可用。 -
$
-
原始的
csh脚本在未经修改的情况下在bash中运行是不太可能的。
标签: linux bash shell compilation sh