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.