0
It's a KSH problems.
I have encounter some problems with variables and quotation marks today. Order doesn't matter, although i cannot read the scripts but only execute it.
SomeScripts.sh "First=Harvey Lo","Third=Rebecca Won","Second=laugh at"
Results:
Harvey Lo laugh at Rebecca Won
but If i try to put it in a ksh scripts file, it doesn't work:
#!/bin/ksh
SOMEVAR=\"First=Harvey Lo\",\"Third=Rebecca Won\",\"Second=laugh at\"
SomeScripts.sh ${SOMEVAR}
Results:
Error: No. of ARGS > 3
I even try the following, but still not work.
#!/bin/ksh
SOMEVAR=\"First=Harvey Lo\",\"Third=Rebecca Won\",\"Second=laugh at\"
SomeScripts.sh `echo ${SOMEVAR}`
Results:
Error: No. of ARGS > 3
can anyone help, all i know that there is some java inside the SomeScripts.sh, the actual function have more than 20 parameters, but i have simplified as shown.
The Original Help File:
SomeScripts.sh First=Harvey,Third=Rebecca,Second=laugh
Harvey laugh Rebecca
Thanks i will try, I read the way it is quote from some previous working examples. not sure why they make that.... Actually those are CN, O, and OU .... but then, i am not quite understand how the first 2 you said are equivalent... the first one seems to have so many - (") double quotes, can you further explain ? – None – 2013-10-24T12:38:44.983
1@AntonyLee: The double-quotes only do one thing: they prevent the shell from splitting the argument into words at each space, and they're always stripped away before the shell actually runs the script. So it doesn't matter how exactly the argument is quoted – it could be
"First=Harvey Lo"
orFirst="Harvey Lo"
or evenFirst=Harvey" "Lo
and it would still mean the same. The quotes just tell the shell to NOT split it into separateFirst=Harvey
andLo
words. – user1686 – 2013-10-24T12:44:51.327Thank, so essentially "Hello" is the same as "HE""""""""llo" ?? – None – 2013-10-24T12:52:16.983