[X-Unix] Why didn't App le change the line break ?

James Bucanek subscriber at gloaming.com
Tue Sep 21 08:21:46 PDT 2004


Eugene Lee wrote on Tuesday, September 21, 2004:

>On Tue, Sep 21, 2004 at 05:09:51AM -0700, Craig wrote:
>: 
>: This may be unrelated, but why is it that on OS X, if you redirect the
>: output of ls or some other commands into a text file then open the
>: file with a text editor, you see something like this:
>: 
>: [01;34malias sketchbook examples[0m
>: [0mls.txt[0m
>: [01;34mnew pix[0m
>: [0moreilly.com -- Online Catalog- PDF Hacks.webloc[0m
>: [0mwiretap.sit[0m
>: [0mzip code article-LVRJ.html[0m
>: [0mzip code map-LVRJ.gif[0m
>: [m

<clip>

>You're not using a standard version of "ls".  Do this and report
>what you see in a text editor:
>
>   $ /bin/ls > files.txt

Eugene's probably right.  You're using a non-standard version of ls or you have something (probably CLICOLOR_FORCE) set in your environment.

I didn't look at your output of ls closely enough.  When you said "ls and some other commands" I assumed you were having this problem with all of your command-line tools.

The garbage you see here are ANSI terminal escape codes.  These are sequences that tell a CRT terminal (or emulator) to switch colors, text styles, or change cursor position.  Normally, ls is smart enough not to ouput these codes if the destination device isn't a termnal.  But you can configure ls to always output color codes, in which case you'll end up with the codes in your file or pipe.  Or you are using a non-standard version of ls that is doing the same thing.

-- 
James Bucanek <mailto:privatereply at gloaming.com>



More information about the X-Unix mailing list