From: Ant on
G'day

The following line from crontab

45 13 * * * /usr/bin/cp /export/home/cckell/scratch
/export/home/cckell/scratch.`/usr/bin/date '+\%A'`

Produces this output ...

-rw-r--r-- 1 ccakell7 ndbaadm 17768 Jun 30 13:19 scratch.\Wednesday


It adds a \ before the Day.

What i want it to produce is ...

scratch.Wednesday

The \ is necessary to escape the %, but I did not expect it to appear in
the output.

Any suggestions appreciated.

Tony
From: Barry Margolin on
In article <i0efth$ei2$1(a)air.soe.uq.edu.au>, Ant <ant(a)example.com>
wrote:

> G'day
>
> The following line from crontab
>
> 45 13 * * * /usr/bin/cp /export/home/cckell/scratch
> /export/home/cckell/scratch.`/usr/bin/date '+\%A'`
>
> Produces this output ...
>
> -rw-r--r-- 1 ccakell7 ndbaadm 17768 Jun 30 13:19 scratch.\Wednesday
>
>
> It adds a \ before the Day.
>
> What i want it to produce is ...
>
> scratch.Wednesday
>
> The \ is necessary to escape the %, but I did not expect it to appear in
> the output.
>
> Any suggestions appreciated.

What OS? I remember seeing this bug about 20 years ago on Solaris.

If your cron implementation still has this bug, then the solution is to
put the commands in a script rather than writing it out in the crontab.

--
Barry Margolin, barmar(a)alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
From: Ant on
Barry Margolin wrote:
> In article <i0efth$ei2$1(a)air.soe.uq.edu.au>, Ant <ant(a)example.com>
> wrote:
>
>> G'day
>>
>> The following line from crontab
>>
>> 45 13 * * * /usr/bin/cp /export/home/cckell/scratch
>> /export/home/cckell/scratch.`/usr/bin/date '+\%A'`
>>
>> Produces this output ...
>>
>> -rw-r--r-- 1 ccakell7 ndbaadm 17768 Jun 30 13:19 scratch.\Wednesday
>>
>>
>> It adds a \ before the Day.
>>
>> What i want it to produce is ...
>>
>> scratch.Wednesday
>>
>> The \ is necessary to escape the %, but I did not expect it to appear in
>> the output.
>>
>> Any suggestions appreciated.
>
> What OS? I remember seeing this bug about 20 years ago on Solaris.
>
> If your cron implementation still has this bug, then the solution is to
> put the commands in a script rather than writing it out in the crontab.
>

OS is Solaris 10

> more /etc/release
Solaris 10 11/06 s10s_u3wos_10 SPARC
Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
Use is subject to license terms.
Assembled 14 November 2006
From: Glenn Jackman on
At 2010-06-30 12:07AM, "Ant" wrote:
> G'day
>
> The following line from crontab
>
> 45 13 * * * /usr/bin/cp /export/home/cckell/scratch
> /export/home/cckell/scratch.`/usr/bin/date '+\%A'`
[...]
> The \ is necessary to escape the %, but I did not expect it to appear in
> the output.

Try double quotes instead of single quotes.

--
Glenn Jackman
Write a wise saying and your name will live forever. -- Anonymous
From: Barry Margolin on
In article <slrni3411t.ll4.glennj(a)smeagol.ncf.ca>,
Glenn Jackman <glennj(a)ncf.ca> wrote:

> At 2010-06-30 12:07AM, "Ant" wrote:
> > G'day
> >
> > The following line from crontab
> >
> > 45 13 * * * /usr/bin/cp /export/home/cckell/scratch
> > /export/home/cckell/scratch.`/usr/bin/date '+\%A'`
> [...]
> > The \ is necessary to escape the %, but I did not expect it to appear in
> > the output.
>
> Try double quotes instead of single quotes.

Why do you think that will make a difference? The only difference
between single and double quotes is when the string contains variable,
arithmetic, or command substitutions.

--
Barry Margolin, barmar(a)alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***