I have this script:
#!/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
In the part of the code that says: # Cancel is pressed I want to insert some type of command that will disconnect the session and close the terminal automatically. Ive tried different variations of exit, exit 1, exit 5, close, etc. but none seem to do the trick