Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: .zshenv file syntax: spanning lines with comments
- X-seq: zsh-users 348
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: Benjamin Drago <drago@xxxxxxxxx>, zsh-users@xxxxxxxxxxxxxxx
- Subject: Re: .zshenv file syntax: spanning lines with comments
- Date: Thu, 8 Aug 1996 20:06:51 -0700
- In-reply-to: Benjamin Drago <drago@xxxxxxxxx> ".zshenv file syntax: spanning lines with comments" (Aug 8, 7:22pm)
- References: <199608090022.TAA14251@xxxxxxxxxxxxxxxx>
- Reply-to: schaefer@xxxxxxx
On Aug 8, 7:22pm, Benjamin Drago wrote:
} Subject: .zshenv file syntax: spanning lines with comments
}
} current version:
}
} export PATH=/home/$USER/bin/$OSTYPE:/home/$USER/bin:/usr/local/bin:/opt/gnu/bin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/vol/local/$OSTYPE/bin
}
} what I would like to do:
}
} export PATH=/home/$USER/bin/$OSTYPE: # arch dependent binaries
} /home/$USER/bin: # arch independent scripts
} /usr/local/bin: # local apps
} /opt/gnu/bin: # gnu tools
} ...
Why are you using `/home/$USER' instead of `~' ?
How about this:
----- snip ----- 8< ---- snip -----
setopt magic_equal_subst # for `export foo=~/bar`
function export() { EXPORT=${1%%\=*} ; typeset -Ux $* }
function +() { eval builtin export ${EXPORT}=\$\{$EXPORT\}:\$1 }
export PATH=/home/$USER/bin/$OSTYPE # arch dependent binaries
+ /home/$USER/bin # arch independent scripts
+ /usr/local/bin # local apps
+ /opt/gnu/bin # gnu tools
+ ...
unfunction export +
----- snip ----- 8< ---- snip -----
Now you can even do stuff like:
export PATH=~/bin/$OSTYPE # arch dependent binaries
+ ~/bin # arch independent scripts
case $OSTYPE in
sun*)
+ $OPENWINHOME/bin # openwindows applications
+ /usr/ccs/bin # compiler tools
+ /opt/bin # optional packages
;;
*)
+ /usr/bin/X11 # X11 applications
;;
esac
+ /usr/local/bin # local apps
+ /opt/gnu/bin # gnu tools
+ ...
I like that so much I might even rewrite my own .zshenv ...
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.nbn.com/people/lantern
New male in /home/schaefer:
>N 2 Justin William Schaefer Sat May 11 03:43 53/4040 "Happy Birthday"
Messages sorted by:
Reverse Date,
Date,
Thread,
Author