i am writing a wrapper script for sshfs and trying to pass on some of it arguments to sshfs
like say sshmount -o allow_others mountpoint
but sshfs also accepts arguments like -o sftp_server="/usr/bin/sudo /usr/lib/openssh/sftp-server"
but this case the quotes gets stripped
i am making use of getopts like this
7 while getopts 'fsCu:p:o:d1hV' flag; do
6 case "${flag}" in
5 u) LD=`fetchHostAttribute $2 'LocalDirectory'`;
4 [ -n $LD ] && { fusermount -$flag $LD && rmdir $LD; }\
3 || echo host missing LocalDirectory attribute in $confile
2 exit;;
1 p) flags+=" -$flag ${OPTARG}";;
39 o) echo ${OPTARG};exit;;
1 C|f|1|s|d) flags+=" -$flag";;
2 V) sshfs --version;exit;;
3 *) print_usage;
4 exit;;
5 esac
6 done
with this snipped the output of sshmount -o sftp_server="/usr/bin/sudo /usr/lib/openssh/sftp-server"
is sftp_server=/usr/bin/sudo /usr/lib/openssh/sftp-server
is there a way to preserve the quotes? simply quoting ${OPTARGS} turns it into "sftp_server=/usr/bin/sudo /usr/lib/openssh/sftp-server"
To whoever marked this as duplicate, yes i'm aware of that question i have stumbled accross it more then i would like, here's the full source https://github.com/fuseteam/sshmount if you think that question solves the issue i described i.e. Turning sshmount -o sftp_server="/usr/bin/sudo /usr/lib/openssh/sftp-server" [user@]host
into sshfs -o sftp_server="/usr/bin/sudo /usr/lib/openssh/sftp-server" [user@]host ~/mountpoint
while preserving the usage of -u
to invoke fusermount.......submit a pull request. I've sunk more time into it than i would like trying to get the answers to those questions to work with it