[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Sheflug] Simple question... simple answer?



And Lo! The Great Prophet Steve Tickle uttered these words of wisdom:
> Hi all,
> 
> Could someone please tell me if and how I can set 'ls' to display in color 
> by default? (ie. equiv. to the command line ls --color=always)
> I'm using ls v4.1

The only way I'm aware of is to set an environment variable, LS_OPTIONS, in 
your .profile or .cshrc (or equivalent, depending on shell).

I use:
	LS_OPTIONS=' --color=auto'
	export LS_OPTIONS

"auto" is preferred over "always", reason being that if you have a script that 
does ls's to get file lists to process, all the filenames that the ls 
returns have the escape sequences to set the colours, thus the script falls 
over because the file ^[[3;45mMyPicture.jpg^[[0m doesn't exist :-) auto 
specifies that if the output is a tty (i.e., a terminal window), then use 
colours, otherwise don't.

Chris...

-- 
\ Chris Johnson                 \ NP: TATy - 02. 30 Minut (30 Minutes)
 \ cej [at] nightwolf.org.uk          \  
  \ http://cej.nightwolf.org.uk/  \ 
   \ http://redclaw.org.uk/        ~---------------------------------------



___________________________________________________________________

Sheffield Linux User's Group -
http://www.sheflug.co.uk/mailfaq.html

  GNU the choice of a complete generation.