From 909ec946440d1a80c23f7e23a90d83823c8557b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Zrounba?= <6691770+clement-z@users.noreply.github.com> Date: Sat, 16 Jan 2021 17:48:28 +0100 Subject: Fix checking for -t and -S before --help --- proxy-tcp-ssh.sh | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/proxy-tcp-ssh.sh b/proxy-tcp-ssh.sh index 98f2c19..ac30bb4 100755 --- a/proxy-tcp-ssh.sh +++ b/proxy-tcp-ssh.sh @@ -41,8 +41,7 @@ OPTIONS EXAMPLES Todo AUTHOR - Clément Zrounba -" + Clément Zrounba" } function parse_args() { @@ -112,18 +111,6 @@ function parse_args() { ;; esac done - - # Check SSHHOST is given - if [ -z "$ARG_SSHHOST" ]; then - echo "Error: no ssh host specified" >&2 - exit 1 - fi - - # Check TUNNELSPEC is given - if [ -z "$ARG_TUNNELSPEC" ]; then - echo "Error: no tunnel(s) specified" >&2 - exit 1 - fi } function check_low_port_cap() @@ -171,6 +158,18 @@ if [ 0 == "$ARG_HELP" ]; then exit 0 fi +# Check SSHHOST is given +if [ -z "$ARG_SSHHOST" ]; then + echo "Error: no ssh host specified" >&2 + exit 1 +fi + +# Check TUNNELSPEC is given +if [ -z "$ARG_TUNNELSPEC" ]; then + echo "Error: no tunnel(s) specified" >&2 + exit 1 +fi + # Assign values or defaults to other parameters from ARG_* variables SSH_HOST=${ARG_SSHHOST:-} BIND_IF=${ARG_BIND_IF:-localhost} -- cgit v1.2.3