技术解析
expect 脚本
#!/usr/bin/expect -f
puts "pwd [pwd]"
git status
expect "$ " {
send $expect_out(0,string)
}
开启 debug 运行结果:
expect version 5.45
argv[0] = expect argv[1] = -d argv[2] = /home/cqh/Nutstore/excode/ch5/get_branch.exp
set argc 0
set argv0 "/home/cqh/Nutstore/excode/ch5/get_branch.exp"
set argv ""
executing commands from command file /home/cqh/Nutstore/excode/ch5/get_branch.exp
pwd /data/youmicode/wind
invalid command name "git"
while executing
"git status"
(file "/home/cqh/Nutstore/excode/ch5/get_branch.exp" line 3)
这种问题怎么解决啊,把git status
替换成spawn git status
也不行