3
在Bash脚本中预期超时
如何在以下脚本中为“期望”添加超时?我想将其设置为120秒。 #!/bin/bash HOST="localhost" USER="myuname" PASS="mypassword" VAR=$(expect -c " spawn ssh $USER@$HOST expect \"password:\" send \"$PASS\r\" expect \"\\\\$\" send \"ls\r\" expect -re \"$USER.*\" send \"logout\" ") echo "===============" echo "$VAR"