From 4a7031d77ef3df29cc9ac7f74ea244f1ad2fcfa4 Mon Sep 17 00:00:00 2001 From: Q Date: Sat, 26 Apr 2025 07:36:21 +0300 Subject: [PATCH] Fix empty --- web/sshfs-mount | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/web/sshfs-mount b/web/sshfs-mount index 6f21b08..52de555 100755 --- a/web/sshfs-mount +++ b/web/sshfs-mount @@ -68,9 +68,12 @@ mkdir -p ~/mnt valid_name=$( echo "$host" | sed -e 's/[^A-Za-z0-9._@-]//g') if [[ -z "$remotepath" ]]; then if [[ -e ~/.ssh/config ]]; then - if grep -q ^"host $host # sshfs" ~/.ssh/config; then + if grep -q ^"host.*$host.*# sshfs" ~/.ssh/config; then # pick only string after 'sshfs' - remotepath=$( grep ^"host $host # sshfs" ~/.ssh/config | head -n 1 | sed "s/^host $host # sshfs //" ) + remotepath=$( grep ^"host.*$host.*# sshfs" ~/.ssh/config \ + | head -n 1 \ + | sed "s/^host.*$host.*# sshfs//" \ + | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' ) fi fi fi