From 4f62ddc933489404102568066d1258c266073df0 Mon Sep 17 00:00:00 2001 From: Nils Date: Sun, 3 Apr 2022 01:41:56 +0200 Subject: [PATCH] fixup last commit --- conn.sh | 13 +++++++++---- hash | 1 - 2 files changed, 9 insertions(+), 5 deletions(-) delete mode 100644 hash diff --git a/conn.sh b/conn.sh index 060b109..a493226 100755 --- a/conn.sh +++ b/conn.sh @@ -57,7 +57,14 @@ function get_args { #quick fix to prevent nslookups interactive mode being triggered by invalid arguments #some other places in the code have also gotten a leading space to prevent similar issues - input=$(echo "$input" | tr -d "-") + for v in $input; do + if [[ ! $(echo $v | cut -c1) == "-" ]];then + newinput="$newinput $v" + else + newinput="$newinput $(echo $v | cut -c 2-)" + fi + done + input="$newinput" } function set_argvars { @@ -86,9 +93,7 @@ function set_argvars { function validate { for arg in $@; do - if [[ ! "$arg" =~ : ]];then - arg=" $arg" # fixes issue with leading space on ipv6 adresses - else + if [[ "$arg" =~ : ]];then only="-6" # enable ipv6, this needs a more complex function to avoid treating every argument as v6 fi if ip route show "$arg" 2&> /dev/null;then diff --git a/hash b/hash deleted file mode 100644 index 08fa868..0000000 --- a/hash +++ /dev/null @@ -1 +0,0 @@ -5137f97b93f5e52c8c31255f582c8328