expect调用shell命令或shell脚本

expect调用shell命令
获取本机IP:
set idcid [exec sh -c {ifconfig eth0 | grep Mask | cut -d: -f2 | awk '{print $1}'}]
调用shell脚本test.sh
set testResult [exec sh -c {./test.sh}]

 

参考资料:https://www.linuxquestions.org/questions/linux-software-2/ksh-tcl-173092/https://www.linuxquestions.org/questions/linux-software-2/ksh-tcl-173092/

你可能感兴趣的:(shell,Linux)