Check if selection != 'user aborted'

This commit is contained in:
Jeffrey Serio 2024-05-13 02:36:48 -05:00
parent 9440b57d09
commit 662ebf0182

6
gumssh
View File

@ -24,9 +24,9 @@ done < "${SSH_CONFIG}"
# 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.
# Store selection. # Store selection.
selection=$(printf "%s\n" "${hostn_array[@]}" | gum choose --limit=1) selection=$(printf "%s\n" "${hostn_array[@]}" | gum choose --header="SSH Host" --limit=1)
# If $selection is non-empty, pass it to the ssh -X command. # If $selection is not aborted by user, pass it to the `autossh -M 0` command.
if test -n "${selection}"; then if [ "${selection}" != "user aborted" ]; then
autossh -M 0 "${selection}" autossh -M 0 "${selection}"
fi fi