[ssh_tools] tabssh: check dependencies
This commit is contained in:
parent
81988f3c00
commit
c661ccd8eb
|
@ -18,6 +18,7 @@ set -u
|
||||||
# Exit codes
|
# Exit codes
|
||||||
readonly EXIT_SUCCESS=0
|
readonly EXIT_SUCCESS=0
|
||||||
readonly EXIT_USAGE=127
|
readonly EXIT_USAGE=127
|
||||||
|
readonly EXIT_DEPENDENCY=4
|
||||||
readonly EXIT_HOSTS_LIST=6
|
readonly EXIT_HOSTS_LIST=6
|
||||||
|
|
||||||
print_usage()
|
print_usage()
|
||||||
|
@ -54,6 +55,13 @@ elif [ $# -ne 1 ] ; then
|
||||||
bad_usage "Wrong number of arguments."
|
bad_usage "Wrong number of arguments."
|
||||||
fi
|
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
|
# Hosts list file
|
||||||
[ -z ${XDG_CONFIG_HOME+x} ] && XDG_CONFIG_HOME="$HOME/.config"
|
[ -z ${XDG_CONFIG_HOME+x} ] && XDG_CONFIG_HOME="$HOME/.config"
|
||||||
HOSTS_LIST_NAME="$1"
|
HOSTS_LIST_NAME="$1"
|
||||||
|
@ -75,5 +83,5 @@ fi
|
||||||
while read -r HOST ; do
|
while read -r HOST ; do
|
||||||
SSH="ssh ${LOGIN}${HOST}"
|
SSH="ssh ${LOGIN}${HOST}"
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
screen -t "$SSH" $SSH
|
$SCREEN -t "$SSH" $SSH
|
||||||
done <"$HOSTS"
|
done <"$HOSTS"
|
||||||
|
|
Loading…
Reference in New Issue