我试图在expect脚本中的某个点终止本地后台进程。考虑一下示例脚本:
#! /usr/bin/expect
set killPID [lindex $argv 0];
set timeout 1
spawn ftp ftp.ftp.com
expect "Name"
send "Username\r"
expect "Password:"
send "xxxxxx\r"
expect "ftp>"
send_user "Killing local process id: $killPID\n"
interact我使用本地进程的id运行这个脚本,我想将其作为第一个参数杀死。如何在interact命令之前终止该进程?
发布于 2014-04-07 12:24:19
若要在不需要交互的本地机器上运行命令,请执行以下操作:
exec kill $killPIDhttps://stackoverflow.com/questions/22911026
复制相似问题