Sort behaves differently: cron vs. user shell
John Ellson
ellson at research.att.com
Sat Sep 2 17:56:32 UTC 2006
W. Michael Petullo wrote:
> I recently made an entry in Bugzilla (# 204562) for the following problem:
>
> /bin/sort uses the LC_ALL environment variable to determine how to sort. There
> seems to be a discrepancy between how this variable is set in a user shell and
> cron's environment.
>
> The bottom line is that this causes scripts to behave differently when
> run in a user shell vs. cron.
>
> My bug was closed as "isn't definitely problem of cron."
>
> I do think this is a bug. A script that uses sort should execute the
> same when run by a user or on behalf of a user by cron. What component
> should this be be filed under?
>
>
Cron doesn't automatically run the user's .profile or .bash_profile,
so the environment is likely different in the cron job.
Probably the safest fix is to always run sort with:
LC_COLLATE=C sort .....
John
More information about the devel
mailing list