Page 1 of 1

DSExecute problem

Posted: Mon Aug 18, 2003 9:55 pm
by calvinlo
Hi all,

I use Call DSExecute("UNIX",myCommand, Output, ErrCode) to execute system command. but i find that if myCommand consists of double quote(") and single quote(') ..mostly as script argument....and it always fail to run.
e.g.
myCommand is testing.sh "hello '1234'"
i use "testing.sh ":'"':"hello '1234'":'"' to concat the command
and when i print out it is ok..but when i execute it seems the argument cannot be passed.

Thanks,
Cal

Posted: Mon Aug 18, 2003 10:35 pm
by kduke
Cal

You do not need to quote your arguments unless there is a space in the argument value.

Kim.


Kim Duke
DwNav - ETL Navigator
www.Duke-Consulting.com

Posted: Mon Aug 18, 2003 11:58 pm
by spracht
Cal

in fact I also sometimes feel the need to quote things, e.g. an email subject that contains blanks or an enumeration.

It's usually helpful to first decide on which quotation mark to use on inner and outer quotation (" or '). If you want to use parameter evaluation should choose " as inner quotation mark.

I would try your example like this:

"testing.sh ":"'":"hello 1234":"'"

which will put single quotation marks around "hello 1234" thus holding it together.

Hope this helps

Stephan

Posted: Tue Aug 19, 2003 12:00 am
by calvinlo
o.. the example contains space~
and so how can i handle if the argument contains space

Thanks,
Cal

Posted: Tue Aug 19, 2003 1:21 am
by spracht
Cal

I think in this case

"testing.sh 'hello 1234'"

would suffice? The composition of the string like you used it is only necessary if you are using variables.


Stephan