I'm trying to run the script test.sh
(which is on my local machine) on a remote server. test.sh
takes an argument that often has multiple words.
test.sh:
#!/bin/bash
while getopts b: opt;
do
case $opt in
b)
bval="$OPTARG"
;;
esac
done
echo $bval
It works fine on my local machine:
./test.sh -b "multi word arg"
Output:
multi word arg
But when I run it on a remote server, like so:
ssh -A user@remotehost "bash -s" -- < ./test.sh -b "multi word arg"
I get only:
multi
Any ideas on how I could pass the full, multi-word argument to the script?