On 2/15/06, Ivan Glushkov <[EMAIL PROTECTED]> wrote:
> Hi,
> if I issue ls . > filelist.txt
> as user I get:
> a binary file like:
>
> ESC[0mESC[0mAcro3nKTzaESC[0m
> ESC[0mfilelist.logESC[0m
> ESC[01;34mgconfd-glushkovESC[0m
> ESC[01;34mkde-glushkovESC[0m
> ESC[01;34mkeyring-CXhOCWESC[0m
> ESC[01;34mksocket-glushkovESC[0m
> ESC[01;35mmapping-glushkovESC[0m
> ESC[01;34morbit-glushkovESC[0m
> ESC[01;34mssh-mmCRYB8783ESC[0m
> ESC[01;35mxmms_glushkov.0ESC[0m
> ESC[0mzmanImD0upESC[0m
> ESC[m
> ...
>
> if I do that like root, I get the list of files as expected.
> What is the difference? Both root and the user are using the same shell.

Unfortunately, by default, ls uses colors to highlight directories and
executables (and others). The default alias provided in .bashrc, with
a stock install, is 'ls --color=auto'. auto is supposed to tell ls to
ensure it is connected to a tty (instead of a file) before spitting
out colors. If that alias is 'ls --color=always', it will always use
colors, regardless of the output.

The solution will be found in your .bashrc file -- either change the
alias to 'ls --color=auto' or remove it entirely, and it should work
OK.

Reply via email to