Skip to content

Instantly share code, notes, and snippets.

@zouppen
Last active October 10, 2017 21:43
Show Gist options
  • Save zouppen/ece7e0c10dcc92c7cf39d2dbef430dc5 to your computer and use it in GitHub Desktop.
Save zouppen/ece7e0c10dcc92c7cf39d2dbef430dc5 to your computer and use it in GitHub Desktop.
Mosh / SSH / Telnet prompt
#!/bin/bash -eu
fail () {
echo
echo "Paina enteriä palataksesi valikkoon."
read
}
tmpfile=`mktemp`
dialog --menu "Mitä tehdään?" 10 30 3 mosh "MObile SHell" ssh "Secure SHell" telnet "TELNET protocol" --inputbox "Anna käyttäjä@palvelin:" 8 40 2>$tmpfile
clear
IFS=$'\t' read -r mode host <$tmpfile || true
case $mode in
ssh)
ssh "$host" || fail
;;
mosh)
mosh "$host" || fail
;;
telnet)
telnet "$host" || fail
,,
esac
rm $tmpfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment