[nycbug-talk] what are your usefull hacks, the real simple ones

Michael Hernandez mhernandez at ocsny.com
Mon May 8 15:00:01 EDT 2006


On May 8, 2006, at 2:43 PM, Marc Spitzer wrote:

> On 5/8/06, Peter Wright <pete at nomadlogic.org> wrote:
>>
>> ok, this one is dumb - and more of a pet peeve thing.  but i've  
>> grown fond
>> of defining your path's ala:
>>
>> # from ~/.cshrc
>> set path = ( ~/bin /bin /sbin\
>> /usr/{bin,sbin,X11R6/bin,local/bin,local/sbin,games} .)
>>
>> not sure why, but on most linux type os's i've used they do not  
>> seem to
>> define path's in this way by default...
>>
>
> It may have to do with which, or which version of, csh you are  
> using.  Tcsh has
> a lot of changes over csh and this may have something to do with it.
> Also it may
> have to do with the simple fact that the other way is simpler, no
> shell expansion
> to figure out.

zsh also allows you to access/set your path via the array path, or  
the environment variable PATH (colon separated).

In my .zshenv I have this array:

paths=( /bin /usr/bin /usr/pkg/bin /usr/local/bin /sbin /usr/sbin / 
usr/local/bin /usr/local/sbin /usr/pkg/sbin /usr/X11R6/bin /usr/ 
games /opt/local/bin /opt/local/sbin ~/bin)

I unset the PATH and path variables that may not be correct  
(depending on whether or not a startup file somewhere has set them)  
and I "for loop" through my array called paths, checking to see if a  
directory exists in the filesystem, and building my path as I go along.

Mike



More information about the talk mailing list