Cron is sorting with ls differently
Cron is sorting with ls differently
am 31.03.2008 03:18:02 von spacemancw
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
Any ideas
Re: Cron is sorting with ls differently
am 31.03.2008 03:51:05 von Bill Marcum
On 2008-03-31, spacemancw 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.
Re: Cron is sorting with ls differently
am 31.03.2008 04:13:16 von Karabasan
sort -f will probably help..
On 30 Mart, 21:18, spacemancw 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 =A0Afile =A0bfile =A0Bfile =A0cfile =A0Cfile
>
> When I run my script at the command line, they get sorted
> alphabetically, the way I want it, as follows
>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 afile =A0Afile =A0bfile =A0Bfile =
=A0cfile =A0Cfile
>
> When the script runs in cron the files are sorted as follows
>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Afile =A0Bfile =A0Cfile =A0afile =
=A0bfile =A0cfile
>
> I tried add /home/myuser/.cshrc to the first line of my shell but no
> luck
>
> Any ideas
Re: Cron is sorting with ls differently
am 31.03.2008 04:36:46 von spacemancw
On Mar 30, 9:51=A0pm, Bill Marcum wrote:
> On 2008-03-31, spacemancw 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 =A0Afile =A0bfile =A0Bfile =A0cfile =A0Cfile
>
> > When I run my script at the command line, they get sorted
> > alphabetically, the way I want it, as follows
>
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 afile =A0Afile =A0bfile =A0Bfile=
=A0cfile =A0Cfile
>
> > When the script runs in cron the files are sorted as follows
>
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Afile =A0Bfile =A0Cfile =A0afile =
=A0bfile =A0cfile
>
> > 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. =A0The 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=3Den_US.UTF-8
LC_CTYPE=3D"en_US.UTF-8"
LC_NUMERIC=3D"en_US.UTF-8"
LC_TIME=3D"en_US.UTF-8"
LC_COLLATE=3D"en_US.UTF-8"
LC_MONETARY=3D"en_US.UTF-8"
LC_MESSAGES=3D"en_US.UTF-8"
LC_PAPER=3D"en_US.UTF-8"
LC_NAME=3D"en_US.UTF-8"
LC_ADDRESS=3D"en_US.UTF-8"
LC_TELEPHONE=3D"en_US.UTF-8"
LC_MEASUREMENT=3D"en_US.UTF-8"
LC_IDENTIFICATION=3D"en_US.UTF-8"
LC_ALL=3D
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
Re: Cron is sorting with ls differently
am 31.03.2008 05:36:46 von spacemancw
On Mar 30, 10:13=A0pm, Karabasan wrote:
> sort -f =A0 will probably help..
>
> On 30 Mart, 21:18, spacemancw 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 =A0Afile =A0bfile =A0Bfile =A0cfile =A0Cfile
>
> > When I run my script at the command line, they get sorted
> > alphabetically, the way I want it, as follows
>
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 afile =A0Afile =A0bfile =A0Bfile=
=A0cfile =A0Cfile
>
> > When the script runs in cron the files are sorted as follows
>
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Afile =A0Bfile =A0Cfile =A0afile =
=A0bfile =A0cfile
>
> > I tried add /home/myuser/.cshrc to the first line of my shell but no
> > luck
>
> > Any ideas
Thanx
sort -f did it