1
expect -c ‘
spawn su - oracle -s check_tablespace.sh
expect "Password:"
send "oracle\n\r"
expect "eof"
exit
‘
2 文件形式:
#!/usr/bin/expect -f
spawn su - oracle -s check_tablespace.sh
expect "Password:"
send "oracle\n\r"
expect "eof" #上面的子进程完了会返回eof字符串
exit
原文地址:https://www.cnblogs.com/as007012/p/10495918.html
时间: 2024-10-13 00:02:42