* .zshenv file syntax: spanning lines with comments
@ 1996-08-09 0:22 Benjamin Drago
1996-08-09 3:06 ` Bart Schaefer
1996-08-09 14:58 ` David Kågedal
0 siblings, 2 replies; 4+ messages in thread
From: Benjamin Drago @ 1996-08-09 0:22 UTC (permalink / raw)
To: zsh-users
This is not a serious problem; just one I've been curious about.
Is there a way to have long variables span multiple lines, with
comments inserted? Something like this:
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
...
Thanks,
Ben
--
Ben Drago drago@hc.ti.com Sysadmin, TI
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: .zshenv file syntax: spanning lines with comments
1996-08-09 0:22 .zshenv file syntax: spanning lines with comments Benjamin Drago
@ 1996-08-09 3:06 ` Bart Schaefer
1996-08-09 9:35 ` Dave Wapstra
1996-08-09 14:58 ` David Kågedal
1 sibling, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 1996-08-09 3:06 UTC (permalink / raw)
To: Benjamin Drago, zsh-users
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"
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: .zshenv file syntax: spanning lines with comments
1996-08-09 3:06 ` Bart Schaefer
@ 1996-08-09 9:35 ` Dave Wapstra
0 siblings, 0 replies; 4+ messages in thread
From: Dave Wapstra @ 1996-08-09 9:35 UTC (permalink / raw)
To: schaefer; +Cc: Benjamin Drago, zsh-users
On Thu, 8 Aug 1996, Bart Schaefer wrote:
> } /home/$USER/bin: # arch independent scripts
>
> Why are you using `/home/$USER' instead of `~' ?
What about good old $HOME?
--
Dave Wapstra
davew@pi.net
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: .zshenv file syntax: spanning lines with comments
1996-08-09 0:22 .zshenv file syntax: spanning lines with comments Benjamin Drago
1996-08-09 3:06 ` Bart Schaefer
@ 1996-08-09 14:58 ` David Kågedal
1 sibling, 0 replies; 4+ messages in thread
From: David Kågedal @ 1996-08-09 14:58 UTC (permalink / raw)
To: zsh-users
Benjamin Drago <drago@hc.ti.com> writes:
> 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
> ...
The simplest way is probably to use $path instead. That is a list
variable that is kept in sync with $PATH
path=( /home/$USER/bin/$OSTYPE # arch dependent binaries
/home/$USER/bin # arch independent scripts
/usr/local/bin # local apps
/opt/gnu/bin # gnu tools
...
)
(It works for me, at least)
--
David Kågedal Lysator Academic Computer Society davidk@lysator.liu.se
http://www.lysator.liu.se/~davidk/ +46-13 17 65 89
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1996-08-09 15:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-08-09 0:22 .zshenv file syntax: spanning lines with comments Benjamin Drago
1996-08-09 3:06 ` Bart Schaefer
1996-08-09 9:35 ` Dave Wapstra
1996-08-09 14:58 ` David Kågedal
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).