[geeks] Shell quoting question...

velociraptor velociraptor at gmail.com
Fri Jul 14 12:54:01 CDT 2006


On 7/14/06, velociraptor <velociraptor at gmail.com> wrote:
> > > 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".
> > >
> > Try using single-quotes instead of double.
>
> Tried that, no go.  Next up was "foo'%'20foo", which also didn't work.

cron entry for that:
30 13 * * * /export/home/nmiller/script "foo'%'20name" > /dev/null 2>&1

cron's log
>  CMD: "/export/home/nmiller/script.sh foo'

In the logs for the above, it appears that sh is considering the first
' to be the end-of-word for the first ", which explains why single
quote inside of double quotes doesn't work.  Doesn't explain the rest
though.

Someone pointed me at a shell language standard web page, so I took a
look at 'man sh' on the Solaris box this is on.  Mentions of special
characters in there, but nothing about % being different from the
rest.

I guess I'm going to have to hack up a transformation. Feh.

=Nadine=



More information about the geeks mailing list