bash 嵌套expect
有一个简单的shell脚本
bash1:
#!/usr/bin/expect
set user [lindex $argv 0]
send_user "user\n"
chmod +x bash1
./bash1 "johnbl"
会得到回显johnbl。
bash2:
#!/bin/bash
echo $0
/usr/bin/expect <<-EOF
set user [lindex $argv 0]
send_user "user\n"
EOF
echo $0
chmod +x bash2
./bash1 "johnbl"
却得不到回显johnbl。
请大神不吝赐教