I am trying to automate some of my stuff and facing a issue, the problem boils down to escaping the value that is being passed as a argument to the script.
myScript.sh
#!/bin/bash
loadPatch -name $1
where $1 is the first argument and can have value like 'p12.9.5-bug34'
Running it as
myScript p12.9.5-bug34
produces no result. I checked with echo $? the output was successful, but the required operation didn't happen.
I replaced $1 with this actual value to test in the script and it worked as expected. There is no way for me to put a print statement in loadPatch to verify what arguments it has received.
So, I envisage there is some escaping problem here and hence need to know, is there any function/utility which I could use to escape the argument before using?
Please let me know if you see any other error with this?
p12.9.5-bug34is a completely harmless name and should work fine despite the lack of quoting"$1". Your problem must be somewhere else.set -xso you can see what's actually being executed.loadPatch -name "$1"