05-09-2005
5,
0
Join Date: May 2005
Last Activity: 18 July 2008, 11:03 AM EDT
Posts: 5
Thanks Given: 0
Thanked 0 Times in 0 Posts
non GNU ls and color on a unix system
Where I work, ls --color is not legal, and only throws illegal option errors back at me. So last week I set out to get some colors going. I have two options:
1) Find someone else's script who's already done this. Well, after 5 days of searching and finding hundreds of references to "ls --color" and nothing as far as someone else writing a script to provide color, this does not seem like an option.
2) Write my own script to do this. Since I mostly program in non-scripting languages, I thought "this can't be too difficult." Searching through man pages has led me to believe I can pipe the outputs of "ls -CF" into a script and then color each file based on what character it ends with. This poses some problems: what existing unix program can I use ( awk? ) to modify each word using regex, and what about non-standard file names that contain spaces?
This is my first scripting project that contains some meaningful depth, and otherwise being fairly new to scripting, I'm at a loss as to just how to do this. However, I do learn fast. Can anyone provide any tips/guidance as to how I can do this?