I pass an argument to bash
as run
. The first command in green executes as expected, however the second in blue fails as the $run
does not expand. I tried to escape the variable with \
thinking the quotes were making the literal translation and also "${run}"
but both did not work to expand the variable run
. What am I missing? Thank you :).
bash script <run>
run=$1
printf -v cmd_q '(cd path/to/dir/%q*/*/out && exec sshpass -f out.txt scp -- *.txt* user@xxx.xx.xxx.xx:/path/to/dentination/*/folder)\n' "${array[@]}"
sshpass -f file.txt ssh -o strictHostKeyChecking=no -t xxx@xxx.xxx.xxx "$cmd_q"
printf -v cmd_q '(cd path/to/dir/%q*/*/out && exec sshpass -f out.txt scp -- *.txt* user@xxx.xx.xxx.xx:/path/to/dentination/"$run"/folder)\n' "${array[@]}"
sshpass -f file.txt ssh -o strictHostKeyChecking=no -t xxx@xxx.xxx.xxx "$cmd_q"