Fix empty

This commit is contained in:
Q
2025-04-26 07:36:21 +03:00
parent 904a8eec05
commit 4a7031d77e

View File

@@ -68,9 +68,12 @@ mkdir -p ~/mnt
valid_name=$( echo "$host" | sed -e 's/[^A-Za-z0-9._@-]//g') valid_name=$( echo "$host" | sed -e 's/[^A-Za-z0-9._@-]//g')
if [[ -z "$remotepath" ]]; then if [[ -z "$remotepath" ]]; then
if [[ -e ~/.ssh/config ]]; 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' # 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 fi
fi fi