ls running on job scheduler gives a strange character

Iwan Tamimi
Iwan Tamimi used Ask the Experts™
on
I have a script on RedHat 6.2 Enterprise Linux contains a simple command as "ls -la > output.txt" if I run the script direct from the terminal the result was OK (the script is a ksh script). The problem if I run from the job scheduler (I am using Hitachi JP/1), the output file contained strange character. I am thinking it is because of the color code, but I tried everything with the same result.
I tried the following commands on the script:
unalias ls
ls -la /tmp/ > /tmp/test_ls_la.txt
/bin/ls -la /tmp > /tmp/test_bin_ls.txt
\ls -la /tmp > /tmp/test_bs.txt
/bin/ls -la --color=none /tmp > /tmp/test_ls_nocolor.txt


all the command above give me the same result:
-rw-r--r-- 1 dmoopr produsers 601071  4æ 18 15:05 2012 /dmo03/dmotmp/prod/tmp/M1dmo/L_HWIMS1_201204181410_2571
-rw-r--r-- 1 dmoopr produsers 255743  4æ 18 15:05 2012 /dmo03/dmotmp/prod/tmp/M1dmo/L_HWIMS1_201204181410_2572

As you can see there is 4æ character.  

Anyone knows how to solve it?

Thank you,

Iwan Tamimi
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
As far as it's located in the place, where the month usually is, we could suppose, that this  is some strange displaying of the month number.

Could You please change the locale in Your script to check this?

Something like the following:

#!/usr/bin/ksh
...

export LANG=en_US.iso88591
ls -la /tmp/ > /tmp/test_ls_la.txt

...

Open in new window

Iwan TamimiSystem Administrator

Author

Commented:
Thank you very much it solves my problem,

Iwan

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial