]> code.delx.au - monosys/commitdiff
ssh-screen-wrapper: more flexible line matching
authorJames Bunton <jamesbunton@delx.net.au>
Thu, 18 Jun 2020 13:37:24 +0000 (23:37 +1000)
committerJames Bunton <jamesbunton@delx.net.au>
Thu, 18 Jun 2020 13:37:24 +0000 (23:37 +1000)
hacks/ssh-screen-wrapper

index 662f08c1b6a63a90c824013bc2768ecabe558f4d..fe083cc5eb0206c50ea5d461bde7efa428390fba 100755 (executable)
@@ -6,7 +6,7 @@ hostname="$(basename "$0")"
 local_hostname="${hostname}.localnet"
 public_hostname="p${hostname}"
 
-if grep -q "^Host ${hostname}$" ~/.ssh/config; then
+if grep -Eq "^Host ${hostname}\b" ~/.ssh/config; then
     true
 elif ping -c1 -t1 "$local_hostname" &> /dev/null; then
     hostname="$local_hostname"