From 4483054c5b6b72bc6ef898dfa8882f07e4d4106f Mon Sep 17 00:00:00 2001 From: Guillaume Archambault Date: Fri, 9 Aug 2024 12:35:07 +0200 Subject: [PATCH] Edited to include the correct ssh config file --- sshm.bash | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sshm.bash b/sshm.bash index 5b8424c..1298ffc 100755 --- a/sshm.bash +++ b/sshm.bash @@ -77,17 +77,18 @@ ssh_manager_connect() { echo "Error: please provide a host number or name." 1>&2 exit 1 fi + if [[ "$host" =~ ^[0-9]+$ ]]; then local host_name host_name=$(grep -E '^Host ' "$config_file" | awk '{print $2}' | grep -v '^#' | sed -n "${host}p") if [ -n "$host_name" ]]; then - ssh "$host_name" + ssh -F "$config_file" "$host_name" else echo "Invalid number." 1>&2 exit 2 fi else - ssh "$host" + ssh -F "$config_file" "$host" fi }