【发布时间】:2016-05-04 03:42:56
【问题描述】:
我无法使用参数运行位于“admin”服务器上的远程 shell 脚本。
ssh koliwada@admin "~/bin/addautomaps $groupentry $homeentry $ticket"
“groupentry”和“homeentry”如下
user1:*:52940:OWNER-user1
user1 -rw,intr,hard,rsize=32768,wsize=32768 basinas01:/ifs/basinas01/home/&
脚本位于管理服务器中的 ~/bin/addautomaps。
我看到了错误,
tput: No value for $TERM and no -T specified
我还看到参数也没有正确传递。 我也尝试过使用“ssh -t ...”,但这不起作用。
【问题讨论】:
-
试试这个:
ssh koliwada@admin script -c "~/bin/addautomaps $groupentry $homeentry $ticket" /dev/null -
@anishsane:你能解释一下你的答案背后的理由吗?
-
我的错。来自
man script:The inner shell of script is always interactive。所以作为-c传递的命令在交互式shell 中运行。 -
内容丰富!那么失败的原因是bash
env变量没有被正确读取呢? -
您需要引用远程 shell 命令中的参数以及 ssh 的整个字符串。有关类似问题,请参阅我的回答 here。那应该解决“正确通过”的问题(假设我理解你的意思)。至于
tput问题,如果您不关心彩色/风格化/等,您可能会忽略此警告。tput可能用于创建的输出。