diff --git a/ssh_tools/tabssh.sh b/ssh_tools/tabssh.sh index ac3538d..ec7f6b4 100755 --- a/ssh_tools/tabssh.sh +++ b/ssh_tools/tabssh.sh @@ -18,6 +18,7 @@ set -u # Exit codes readonly EXIT_SUCCESS=0 readonly EXIT_USAGE=127 +readonly EXIT_DEPENDENCY=4 readonly EXIT_HOSTS_LIST=6 print_usage() @@ -54,6 +55,13 @@ elif [ $# -ne 1 ] ; then bad_usage "Wrong number of arguments." fi +# Check dependencies +SCREEN=$(command -v screen) +if [ -z "$SCREEN" ] ; then + err "GNU screen is required by this script." + exit $EXIT_DEPENDENCY +fi + # Hosts list file [ -z ${XDG_CONFIG_HOME+x} ] && XDG_CONFIG_HOME="$HOME/.config" HOSTS_LIST_NAME="$1" @@ -75,5 +83,5 @@ fi while read -r HOST ; do SSH="ssh ${LOGIN}${HOST}" # shellcheck disable=SC2086 - screen -t "$SSH" $SSH + $SCREEN -t "$SSH" $SSH done <"$HOSTS"