I am trying to create a bash file which calls a program that expects a parameter to submitted between two double quotes.Take a look at my file content.#!/bin/bashecho ./yowsup/yowsup-cli demos --s $1 \$2\ -c yowsup/config &./yowsup/yowsup-cli demos --s $1 \$2\ -c yowsup/config &The echo part prints exactly the command I need, but when I comes to execute it (next line), I am messing it up.How can I get this fixed?Thanks!This is how I need to call it:./yowsup/yowsup-cli demos --s 9999999999 my parameter -c yowsup/configEcho result:./yowsup/yowsup-cli demos --s 9999999999 my parameter -c yowsup/configCall result:demos: error: unrecognized arguments: parameterCopying and pasting echo results:INFO:yowsup.demos.sendclient.layer:Message sent
Double quotes in bash
bash;shell;quoting
You need to escape the quotes in the echo command to see them in the output, but you shouldn't escape them in the actual command:#!/bin/bashecho ./yowsup/yowsup-cli demos --s $1 \$2\ -c yowsup/config &./yowsup/yowsup-cli demos --s $1 $2 -c yowsup/config &The quotes are used in the actual command to prevent splitting of $2 - which contains multiple words.