Pergunta

I am trying to kill a local background process at a certain point in an expect script. Consider the sample script:

#! /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

I run this script with the id of a local process that I want to kill as first argument. How can I kill the process just before the interact command?

Foi útil?

Solução

To run a command on the local machine that requires no interaction, do:

exec kill $killPID
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top