Created
January 28, 2018 16:56
-
-
Save Ketrel/606638e09ce2e3bfbfa35ad625083af6 to your computer and use it in GitHub Desktop.
SSH Connect Shortcut
This file contains 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/sh | |
e="\033" | |
clu(){ | |
if [ ! -z ${1} ] && [ $(tput colors) -ge 8 ]; then | |
printf "${e}[${1}m" | |
fi | |
} | |
prog="" | |
default="server" | |
pathmod="/local" | |
if [ -z ${1} ]; then | |
printf -- "---$(clu '41;1') %b $(clu 0)---\n" "Invalid Use Of Script" | |
exit 1 | |
fi | |
#-------------------# | |
if [ "${1}" = "local" ] || [ "${1}" = "remote" ]; then | |
prog="${default}" | |
pathmod="/${1}" | |
else | |
prog="${1}" | |
fi | |
#-------------------# | |
if [ ! -z ${2} ] && ([ "${2}" = "local" ] || [ "${2}" = "remote" ]); then | |
pathmod="/${2}" | |
elif [ ! -z ${2} ]; then | |
printf -- "---$(clu '41;1') %b $(clu 0)---\n" "Invalid Use Of Script" | |
exit 1 | |
fi | |
#-------------------# | |
if [ -f "$HOME/Scripts/sshcon_scripts${pathmod}/${prog}" ]; then | |
. "$HOME/Scripts/sshcon_scripts$pathmod/${prog}" | |
else | |
printf -- "---$(clu '41;1') %b $(clu 0)---\n" "Specified Connection Command Invalid" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment