mirror of
https://github.com/ivanilves/xiringuito.git
synced 2025-05-31 22:40:16 -07:00
Added optional parameters
This commit is contained in:
parent
8605155360
commit
3808955f85
32
xiringuito
32
xiringuito
@ -4,6 +4,16 @@
|
|||||||
#
|
#
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
function print_help() {
|
||||||
|
echo "Usage: ${0} [OPTIONS] [SSH_USER@]SSH_SERVER [NETWORK1, NETWORK2, ... NETWORKx]"
|
||||||
|
echo
|
||||||
|
echo "OPTIONS"
|
||||||
|
echo "-R do not reconnect after connection failure"
|
||||||
|
echo "-D do not fetch DNS config from server"
|
||||||
|
echo "-h show this extremely helpful message"
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
declare -r KERNEL=$(uname -s | tr [A-Z] [a-z])
|
declare -r KERNEL=$(uname -s | tr [A-Z] [a-z])
|
||||||
if [[ ${KERNEL} != linux && ${KERNEL} != darwin ]]; then
|
if [[ ${KERNEL} != linux && ${KERNEL} != darwin ]]; then
|
||||||
echo "Unsupported system: ${KERNEL}"
|
echo "Unsupported system: ${KERNEL}"
|
||||||
@ -19,10 +29,30 @@ if [[ ${KERNEL} == darwin ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ${#} -lt 1 ]]; then
|
if [[ ${#} -lt 1 ]]; then
|
||||||
echo "Usage: ${0} [SSH_USER@]SSH_SERVER [NETWORK1, NETWORK2, ... NETWORKx]"
|
print_help
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
while getopts "RDh" o; do
|
||||||
|
case ${o} in
|
||||||
|
R)
|
||||||
|
NO_RECONNECT=true
|
||||||
|
;;
|
||||||
|
D)
|
||||||
|
NO_DNS=true
|
||||||
|
;;
|
||||||
|
h)
|
||||||
|
print_help
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
print_help
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
shift $((OPTIND-1))
|
||||||
|
|
||||||
cd $(dirname ${0})
|
cd $(dirname ${0})
|
||||||
|
|
||||||
./scripts/client-preexec.sh
|
./scripts/client-preexec.sh
|
||||||
|
Loading…
x
Reference in New Issue
Block a user