Page 1 of 1

space as parameter of dsjob -run

Posted: Tue Aug 05, 2008 11:14 am
by banactp
I need to pass a single blank space as a parameter value using dsjob:

Code: Select all

dsjob -run -jobstatus -param some_param=' ' myProject myJob
Single or double quotes used as shown above produce a syntax error:

Code: Select all

Invalid arguments: dsjob -run...
I've tried omitting the quotes, escaping the quotes, using a single backslash, different Unix shells, all to no avail and am out of ideas.

Can this be done? If so, how?

Posted: Tue Aug 05, 2008 11:33 am
by iDomz
Try this

typeset space=" "
dsjob -run -jobstatus -param some_param=$space myProject myJob


edit : you may have to put quotes around $space based on your shell. Unfortunately, I don't have access to one to try out.

Posted: Tue Aug 05, 2008 11:40 am
by banactp
iDomz wrote:Try this

typeset space=" "
dsjob -run -jobstatus -param some_param=$space myProject myJob
Good idea. I tried, but it was interpreted as passing an empty string for the parameter value.

edit: Tried that, too (the quotes), but that just substituted the space so I'm back to the same syntax error I started with...

Posted: Tue Aug 05, 2008 11:53 am
by iDomz
There was hardly a chance of that working out anyways :wink:

Why not pass a random string as parameter and substitute it for space within DS?

Posted: Tue Aug 05, 2008 12:01 pm
by chulett
Or set the default value in the job to a space and then don't mention the parameter name/value pair on the command line.

Posted: Tue Aug 05, 2008 12:12 pm
by banactp
Can't set the default to a space because there is already a non-space default!

Anyway, my workaround for now (because this has to be in place by tonight) will be to add substitution handling in the sequence for some_param=NONE.

But there's got to be a better way...

Posted: Tue Aug 05, 2008 12:15 pm
by chulett
For an "optional" parameter, you are much better off (IMHO) leaving the default empty and only supplying a value when it is actually needed. If you can.