[geeks] Shell quoting question...
Sheldon T. Hall
shel at tandem.artell.net
Fri Jul 14 12:17:36 CDT 2006
Velociraptor wrote ...
>
> I'm having some trouble with a cron job, I can't figure out how to
> escape it to make it work...
>
> The script takes an argument that is the name of a profile for use by
> another application. The sole purpose of my script is to wrap the app
> and generate error mail if the run fails.
>
> If the profile exists, the directory exists as well, so I am using
> that as a way to ensure there's no errors in the profile name.
> Unfortunately the profiles are generated by a web interface, so a
> space in the profile name is converted to %20 in the directory name.
> The CLI version of the application that processes the profile will
> accept either the space or %20 when you execute the app in an
> interactive terminal.
>
> In my crontab entry:
>
> 00 05 * * * /export/home/nmiller/script "profile%20name" >
> /dev/null 2>&1
>
> If I issue the above in an interactive shell, it works fine.
>
> But in the cron log I see this:
>
> sh /export/home/nmiller/script "profile
>
> I tried escaping the %, e.g. "profile\%20name", but that just resulted
> in a line in my cron log with my script's exit code for "bad
> argument".
Single quote marks instead of the regular quote marks you are using, maybe?
-Shel
More information about the geeks
mailing list