Re: Cron is sorting with ls differently
- From: Michael Tosch <eedmit@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 31 Mar 2008 15:26:52 +0200
spacemancw wrote:
On Mar 30, 9:51 pm, Bill Marcum <marcumb...@xxxxxxxxxxxxx> wrote:On 2008-03-31, spacemancw <spacema...@xxxxxxxxx> wrote:
I am running a script in cron and it is does an 'ls' differently thanDid you source .cshrc? Otherwise, any variables set in there would be
when I run the script in my shell at the command line. I ran a quick
experimen to see how cron sorts file with ls ( I also tried ls -x).
I made a folder with these files
afile Afile bfile Bfile cfile Cfile
When I run my script at the command line, they get sorted
alphabetically, the way I want it, as follows
afile Afile bfile Bfile cfile Cfile
When the script runs in cron the files are sorted as follows
Afile Bfile Cfile afile bfile cfile
I tried add /home/myuser/.cshrc to the first line of my shell but no
luck
lost. The variable you need to set is LANG or LC_COLLATE.- Hide quoted text -
- Show quoted text -
Thanx
wheb I type locale at my comman line I get
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
so am I supposed to load this under cron?
I added all these lines to the top of my script but it didn't make a
difference
thanx
You must export these variables.
In your script, you need to export these variables.
Alternatively you can just replace
ls
by
LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 ls
--
Michael Tosch @ hp : com
.
- References:
- Cron is sorting with ls differently
- From: spacemancw
- Re: Cron is sorting with ls differently
- From: Bill Marcum
- Re: Cron is sorting with ls differently
- From: spacemancw
- Cron is sorting with ls differently
- Prev by Date: Re: shell script replacing original file
- Next by Date: How To Debug a Running Shell Script
- Previous by thread: Re: Cron is sorting with ls differently
- Next by thread: Re: Cron is sorting with ls differently
- Index(es):
Relevant Pages
|
|