1
如何使用expect
和title
执行命令文件(macOS)或类似的(GNU/Linux)?命令文件:预期+标题。我怎样才能做到这一点?
现在我用这个:
#!/usr/bin/expect -f
set timeout -1
spawn rm -rf /path/to/.ssh/known_hosts
spawn ssh [email protected]
expect "?"
send "yes\r"
expect "assword:"
send "thepassword\r"
expect "thenamemachine:~#"
send "bash <(curl -s aFile.sh)\r"
interact
但我怎么可以添加此
title='My first title'
echo -n -e "\033]0;$title\007"
因此不起作用
#!/usr/bin/expect -f
title='My first title'
echo -n -e "\033]0;$title\007"
set timeout -1
spawn rm -rf /path/to/.ssh/known_hosts
spawn ssh [email protected]
expect "?"
send "yes\r"
expect "assword:"
send "thepassword\r"
expect "thenamemachine:~#"
send "bash <(curl -s aFile.sh)\r"
interact
非常感谢您!并非常感谢** exec **提示! – DylanDog