Last active
October 10, 2017 21:43
-
-
Save zouppen/ece7e0c10dcc92c7cf39d2dbef430dc5 to your computer and use it in GitHub Desktop.
Mosh / SSH / Telnet prompt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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