//Tips tagged dialog
Latest tips by RSS
Click here to subscribe
Follow Shell-Fu on Twitter
Click here to follow
Follow Shell-Fu on identi.ca
Click here to follow
This a dialog script that asks the user a couple of questions and then does something with the answers.

It was something quick and dirty to accomplish a task I needed.

# This piece asks a question and stores the answer in a buffer file.
dialog --inputbox "Enter the hostname or IP of the SCS device you want to connect to..." 10 60 2>/home/SCS/out/server

# This was another piece of information that I needed to accomplish the task I needed.
dialog --inputbox "Enter the port on the SCS device that you want to connect to" 10 60 2>/home/SCS/out/port

# Here is where i set my variables with the buffer files from above.
SERVER=`cat /home/SCS/out/server`
PORT=`cat /home/SCS/out/port`

# This was just a piece to help me make sure my variable were set right.
# I often write in escape route in my scripts so that i can test them without blowing stuff up.
echo "You will now be transported to $SERVER on port $PORT."

# Here I give myself 5 seconds to ctrl +c the script.
sleep 5

#and finally the action to take with the answers from above.
ssh $SERVER -t -t connect $PORT

View Comments »

Home Latest Browse Top 25 Random Hall Of Fame Contact Submit