From af87759ab17fa5d2f3666aa6f7ff87e6d9a27e5c Mon Sep 17 00:00:00 2001 From: Jeffrey Serio <23226432+hyperreal64@users.noreply.github.com> Date: Wed, 12 Jul 2023 23:49:23 -0500 Subject: [PATCH] fix: use Host line instead of HostName --- gumssh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gumssh b/gumssh index d0c0b0d..dcaa4bc 100755 --- a/gumssh +++ b/gumssh @@ -18,16 +18,16 @@ logins=() # Read Users from ssh config and store them in usern_array. while IFS= read -r line; do if [[ "$line" == *"User"* ]]; then - usern=$(echo $line | awk '{ print $2 }') - usern_array+=($usern) + usern=$(echo "$line" | awk '{ print $2 }') + usern_array+=("$usern") fi done < "${SSH_CONFIG}" # Read HostNames from ssh config and store them in hostn_array. while IFS= read -r line; do - if [[ "$line" == *"HostName"* ]]; then + if [[ "$line" == *"Host "* ]]; then hostn=$(echo $line | awk '{ print $2 }') - hostn_array+=($hostn) + hostn_array+=("$hostn") fi done < "${SSH_CONFIG}" @@ -38,7 +38,7 @@ let "array_len = ${#usern_array[@]} - 1" # pairs, then store them in the logins array in "user@host" format. for i in $(seq 0 $array_len); do userhost=$(printf "%s@%s" "${usern_array[i]}" "${hostn_array[i]}") - logins+=($userhost) + logins+=("$userhost") done # Print each member of logins array on a new line and pipe to gum choose.