Re: Cron is sorting with ls differently



On 2008-03-31, spacemancw <spacemancw@xxxxxxxxx> wrote:


I am running a script in cron and it is does an 'ls' differently than
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

Did you source .cshrc? Otherwise, any variables set in there would be
lost. The variable you need to set is LANG or LC_COLLATE.
.



Relevant Pages