Linux 非交互式会话除外
我用的是docker容器。我需要通过expect脚本向容器发送bash命令,但我不想打开控制台Linux 非交互式会话除外,linux,tcl,expect,Linux,Tcl,Expect,我用的是docker容器。我需要通过expect脚本向容器发送bash命令,但我不想打开控制台 #!/usr/bin/expect set cont_name [lindex $argv 0]; spawn docker attach vont1 send "netconfd&\n" interact 问题是我需要在不打开控制台的情况下实现这一点。如果我删除了interact,那么我就无法向容器发送命令。是否有任何方法可以在不进行交互的情况下向容器(bashshell)发送命令,以便在
#!/usr/bin/expect
set cont_name [lindex $argv 0];
spawn docker attach vont1
send "netconfd&\n"
interact
问题是我需要在不打开控制台的情况下实现这一点。如果我删除了interact,那么我就无法向容器发送命令。是否有任何方法可以在不进行交互的情况下向容器(bashshell)发送命令,以便在后台执行 您是否可以尝试在后台运行它,添加
&
,并将交互
替换为预期
?谢谢……它可以工作:)