当我运行自动授权用户的脚本时:
expect -c '
log_user 0
spawn /usr/bin/sudo su - <username>
expect "password: "
sleep 5
send "password\n"
interact
'
其结果是:
send: spawn id exp4 not open while executing
当我运行自动授权用户的脚本时:
expect -c '
log_user 0
spawn /usr/bin/sudo su - <username>
expect "password: "
sleep 5
send "password\n"
interact
'
其结果是:
send: spawn id exp4 not open while executing