我有这个脚本:
#!/bin/bash
#!/usr/bin/expect
dialog --menu "Please choose the server to connect to:" 10 30 15 1 RAS01 2>temp
#OK is pressed
if [ "$?" = "0" ]
then
        _return=$(cat temp)
        # /home is selected
        if [ "$_return" = "1" ]
        then
                dialog --infobox "Connecting to server ..." 5 30  ; sleep 2
                telnet XXX
        fi
# Cancel is pressed
else
        exit
fi
# remove the temp file
rm -f temp
在代码的一部分中说:# Cancel is pressed我想插入某种类型的命令,该命令将断开会话并自动关闭终端。我尝试了exit, exit 1, exit 5,close等的不同变体,但似乎没有一个能奏效