Got it !!

My home-directory contains a subdirectory 'X'. That's why only from the
cron-job, the output gets garbled; else from the command prompt in
the 'remind' directory, it works fine.

Thanks Lawson !!
--
"Sanchet Surendra Dighe" <[EMAIL PROTECTED]> wrote:
>Hi,
>
>I am using bash indeed !! But, my directory reads -
>
>[sanchetd@den remind]$ ls
>FRIDAY THURSDAY  WEDNESDAY  reminder.bash
>MONDAY TUESDAY   daily.log  reminder.bash.1
>
>Nowhere there is any 'X'. Then, why should it substitute [A-Z] with X ?
>as in -
>
>++ date +%A
>++ tr [a-z] X    ##### The command was TODAY=`date +%A|tr [a-z] [A-Z]`
>+ TODAY=TXXXXXX
>+ SUBJECT=Activities for the day : TXXXXXX
>+ cat /home/sanchetd/remind/TXXXXXX
>+ mail -s Activities for the day : TXXXXXX [EMAIL PROTECTED]
>cat: /home/sanchetd/remind/TXXXXXX: No such file or directory
>Null message body; hope that's ok
>
>As I said, this happens only in the cron-job. When run from the bash
>command-prompt, the script works fine -
>
>++ date +%A
>++ tr [a-z] [A-Z]
>+ TODAY=THURSDAY
>+ SUBJECT=Activities for the day : THURSDAY
>
>I am still pretty much confused. Can you clear my doubts, please ?
>
>TIA.
>
>Sanchet
>--
>[EMAIL PROTECTED] wrote:
>>
>>
>>On Wed, 14 Mar 2001, Sanchet Surendra Dighe wrote:
>>
>>> Hello Marc,
>>>
>>> I had some problems with converting case with 'tr' the way you have
>>> done.
>>>
>>> I had a tr [a-z] [A-Z]. When I execute
>>>
>>> date +%A|tr [a-z] [A-Z]
>>>
>>> it gives me XXXXX instead of the proper day in upper case. This happens

>>> only when I use this inside a cron-job. From the command-line it works
>>> fine.
>>
>>If you use bash as your shell, it will attempt pattern matching on [a-z]
>>to the names (of files and subdirectories) in the current directory, and
>>if it finds any names that consist of a single letter, it will
>>substitute these names for the parameter [a-z].  This is likely to make
>>a mess of the parameters to tr, and is probably not what you intended.
>>
>>Script started on Wed Mar 14 13:26:07 2001
>>[whit@giftie whit]$ echo [a-z]
>>e i l n o p u
>>[whit@giftie whit]$ ls -l e
>>-rw-r--r--   1 whit    uucp            2 Jan 11 14:17 e
>>[whit@giftie whit]$ ls -l f
>>ls: f: No such file or directory
>>[whit@giftie whit]$ exit
>>exit
>>
>>Script done on Wed Mar 14 13:26:51 2001
>>>
>>> Later, I changed the tr arguments to
>>>
>>> tr [:lower:] [:upper:]
>>>
>>> And, it started working in the cron-job without any garbled output.
>>
>>by luck, there are no names in the current directory named l, o, w, e,
>>r, or :
>>>
>>> Can someone figure out why it used to give that kind of output in the
>>> cronjob at first ?
>>>
>>> -Sanchet
>>> --
>>
>>If you don't want bash to do this, protect the parameters from the shell
>>by quoting them, so:
>>
>>tr "[a-z]" "[A-Z]"
>>
>>tr "[:lower:]" "[:upper:]"
>>
>>Script started on Wed Mar 14 13:33:17 2001
>>[whit@giftie whit]$ echo [:lower:]
>>: e l o
>>[whit@giftie whit]$ echo "[:lower:]"
>>[:lower:]
>>[whit@giftie whit]$ exit
>>exit
>>
>>Script done on Wed Mar 14 13:33:50 2001
>>
>>Lawson
>>
>>For the man who rises early is a man whose life is lost.
>>He will never know what he has missed till he's counted up the cost.
>>It's too late to put eggs in the nest when the bird's already flown.
>>If you're known as an early riser you can sleep till the cows com home.
>>                           - Robbie O'Connell
>>
>>
>>________________________________________________________________
>>GET INTERNET ACCESS FROM JUNO!
>>Juno offers FREE or PREMIUM Internet access for less!
>>Join Juno today!  For your FREE software, visit:
>>http://dl.www.juno.com/get/tagj.
>>
>
>
>-
>To unsubscribe from this list: send the line "unsubscribe linux-newbie" in

>the body of a message to [EMAIL PROTECTED]
>Please read the FAQ at http://www.linux-learn.org/faqs
>


-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.linux-learn.org/faqs

Reply via email to