I try to automate some tasks with an exepect file, but when I try to send cat and display my file nothing happens, the file exists, I can display it when I type the command manually. I have the impression that it is working in the background, but this is not the result I expect.
#!/usr/bin/expect
set ip [ lindex $argv 0 ]
set port [ lindex $argv 1 ]
set user [ lindex $argv 2 ]
set password [ exec cat "../../flag04/flag" ]
spawn ssh "$user\@$ip" "-p $port"
expect "password:" { send "$password\r" }
send "echo 'bin/getflag >> /tmp/flag05' >> /opt/openarenaserver/script.sh\r"
expect ":~$" { send "cat /tmp/flag05\r" }
interact
CodePudding user response:
I just find the anwser, it missed a space after :$
after the dollar sign