Created
April 10, 2013 09:03
-
-
Save tribut/5353055 to your computer and use it in GitHub Desktop.
call mosh_pc.sh for list of hosts, mosh otherwise
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/bash | |
# ########################################################## # | |
# wrapper for mosh that will call mosh_pc.sh for a list of # | |
# host and mosh otherwise. see mosh_pc.sh why you might want # | |
# this. # | |
# ########################################################## # | |
# >> modify this | |
indirect_access=(asterix obelix idefix) | |
# << | |
# this should be easier... | |
function contains() { | |
for value in "${indirect_access[@]}"; do | |
if [ "$value" == "$1" ]; then | |
return 0 | |
fi | |
done | |
return 1 | |
} | |
# get target hostname from potentially more complex commandline | |
hostname="`getopt -q -o'-' -- $@ | cut -d\' -f2`" | |
if contains "$hostname"; then | |
mosh_pc.sh "$@" | |
else | |
mosh "$@" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment