![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| AIX AIX is IBM's industry-leading UNIX operating system that meets the demands of applications that businesses rely upon in today's marketplace. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Six Color Scanning | iBot | UNIX and Linux RSS News | 0 | 06-23-2008 06:20 AM |
| Vim color | mirusnet | Shell Programming and Scripting | 1 | 01-06-2008 12:43 PM |
| Different color in mail | shahnazurs | Shell Programming and Scripting | 1 | 11-02-2007 05:42 AM |
| ls color | andryk | AIX | 3 | 05-14-2004 04:26 AM |
| Color and Users | arn_ch | UNIX for Dummies Questions & Answers | 5 | 11-06-2000 03:42 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
ls color on AIX
Hi,
I have retrieved the following rpm coreutils-5.2.1-2.aix5.1.ppc.rpm to get color with ls command. It doesnt work very well with | more. ls -ltr | more ^[[0mtotal 8 -rwxr--r-- 1 ora10 dba 4362 2009-01-08 11:08 ^[[01;32mora_base.ksh^[[0m ^[[m It works fine with pg ls -ltr | pg total 8 -rwxr--r-- 1 ora10 dba 4362 2009-01-08 11:08 ora_base.ksh Do U know why ? Thanks in advance. |
|
||||
|
I do not have that package installed, so I cannot test. Have you tried using the 'less' command? It does more than more. You can scroll back up, search, etc. I'm not sure, but it may also fix your color issue.
If the less command is not on your AIX host, it is included on the Linux Apps for AIX CD that comes with the OS disks. |
|
||||
|
more - as well as pg - act both as text filters. Both are intended to be fed pure text streams and everything else (that includes termcap sequences or ANSI sequences) is not guaranteed to work at all.
That was the short answer. The same effect, for example you will see when feeding a non-english text with umlauts or other diacritical extravaganza to "more" and/or "pg". Some - more by chance than intendedly so - works, most do not. The reason for your problem is that the colours in "ls" come from injections of terminal steering sequences into the stream of characters and whitespace. Here is the principle: Code:
without LS_COLOURS # ls -lrt total 128 54198505 drwxr-xr-x 3 user user 4096 Jan 6 18:06 . 54165666 drwxr-xr-x 17 user user 4096 Jan 6 18:06 .. 54198511 -rw------- 1 user user 1066 Jan 6 18:06 file1 54198519 -rw------- 1 user user 21451 Jan 6 18:06 file2 54198519 drw------- 1 user user 21451 Jan 6 18:07 dir1 with LS_COLOURS # ls -lrt total 128 54198505 drwxr-xr-x 3 user user 4096 Jan 6 18:06 <ESC-Seq>.<ESC-Seq> 54165666 drwxr-xr-x 17 user user 4096 Jan 6 18:06 <ESC-Seq>..<ESC-Seq> 54198511 -rw------- 1 user user 1066 Jan 6 18:06 <ESC-Seq>file1<ESC-Seq> 54198519 -rw------- 1 user user 21451 Jan 6 18:06 <ESC-Seq>file2<ESC-Seq> 54198519 drw------- 1 user user 21451 Jan 6 18:07 <ESC-Seq>dir1<ESC-Seq> There are two possible explanations for your problem: the first one is, that "ls" behaves differently if writing to a terminal or a pipeline. For instance, if you issue "ls" (without parameter) the output will be in several columns. If you issue "ls | pg" you will notice that it is formatted not in several but only one column. "ls" is designed that way because it makes writing scripts easier (if you have to split the columns back to single files first it would be more complicated to cycle through files in a loop), see "man ls" for details on this. Maybe it is the same with the colours and they are suppressed if ls notices that it is run in a pipeline to not interfere with scripting. The other possible explanation is, that more eats away on the ESC-sequences because it doesn't know hoe to deal with them for reasons described above. Try using "less" as a "more"-replacement in this case, because i suppose it will - coming from the same source, so to say - be able to deal with the formatting sequences better. I hope this helps. bakunin PS for Padov: "more" can scroll forward and backwards too, at least in its AIX version: use the navigating keys known from vi, like: "k" = line up "j" = line down etc. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|