mirror of
https://codeberg.org/hyperreal/bin
synced 2024-11-25 10:23:42 +01:00
fix: use Host line instead of HostName
This commit is contained in:
parent
a2540ce77e
commit
af87759ab1
10
gumssh
10
gumssh
@ -18,16 +18,16 @@ logins=()
|
|||||||
# Read Users from ssh config and store them in usern_array.
|
# Read Users from ssh config and store them in usern_array.
|
||||||
while IFS= read -r line; do
|
while IFS= read -r line; do
|
||||||
if [[ "$line" == *"User"* ]]; then
|
if [[ "$line" == *"User"* ]]; then
|
||||||
usern=$(echo $line | awk '{ print $2 }')
|
usern=$(echo "$line" | awk '{ print $2 }')
|
||||||
usern_array+=($usern)
|
usern_array+=("$usern")
|
||||||
fi
|
fi
|
||||||
done < "${SSH_CONFIG}"
|
done < "${SSH_CONFIG}"
|
||||||
|
|
||||||
# Read HostNames from ssh config and store them in hostn_array.
|
# Read HostNames from ssh config and store them in hostn_array.
|
||||||
while IFS= read -r line; do
|
while IFS= read -r line; do
|
||||||
if [[ "$line" == *"HostName"* ]]; then
|
if [[ "$line" == *"Host "* ]]; then
|
||||||
hostn=$(echo $line | awk '{ print $2 }')
|
hostn=$(echo $line | awk '{ print $2 }')
|
||||||
hostn_array+=($hostn)
|
hostn_array+=("$hostn")
|
||||||
fi
|
fi
|
||||||
done < "${SSH_CONFIG}"
|
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.
|
# pairs, then store them in the logins array in "user@host" format.
|
||||||
for i in $(seq 0 $array_len); do
|
for i in $(seq 0 $array_len); do
|
||||||
userhost=$(printf "%s@%s" "${usern_array[i]}" "${hostn_array[i]}")
|
userhost=$(printf "%s@%s" "${usern_array[i]}" "${hostn_array[i]}")
|
||||||
logins+=($userhost)
|
logins+=("$userhost")
|
||||||
done
|
done
|
||||||
|
|
||||||
# Print each member of logins array on a new line and pipe to gum choose.
|
# Print each member of logins array on a new line and pipe to gum choose.
|
||||||
|
Loading…
Reference in New Issue
Block a user