0   我想使用minicom或ssh连接打开一个新终端,并使用Shell脚本在该新窗口中与其他用户一起运行命令。我在shell脚本中尝试编写以下命令:
#! /usr/bin/tcsh -f
set Flag1 = 1
while ($Flag1)
if ($Flag1)then
`xterm -e /home/Script/First.sh`
set Flag1 = 0
endif
end
cat /home/Script/First.sh
#! /usr/bin/tcsh -f
sudo minicom -D /dev/ttyUSB0
ifconfig eth0 10.120.140.3
ping -w20 10.120.140.1
第一个命令(minicom)起作用了,但没有继续执行其他命令。
答案 0 :(得分:0)
我不知道我是否理解正确,但是是否要使用cmd1 && cmd2接连执行一个命令 因此,如果您希望在ssh连接后执行exec命令:
minicom... ssh tal@ip 'ifconfig && ping'
并将shebang添加为脚本的第一行:
#!/bin/sh