zsh-users
 help / color / mirror / code / Atom feed
* Tying multiple environment variables together
@ 2001-04-11 16:18 Steve Talley
  2001-04-11 16:53 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Steve Talley @ 2001-04-11 16:18 UTC (permalink / raw)
  To: zsh-users

Hi,

There are three environment variables that are used by various
programs, that all need to be the same value.  From .zshenv:

export JAVA_HOME=/usr/java
export JDKHOME=$JAVA_HOME
export JDK_HOME=$JAVA_HOME

Unfortunately when I change the value of one I have to change all
three.  Is it possible to tie the values together, so that after
changing one they all get changed?  Something along the lines of
typeset -T, but for environment variables?

Thanks,

Steve


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Tying multiple environment variables together
  2001-04-11 16:18 Tying multiple environment variables together Steve Talley
@ 2001-04-11 16:53 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2001-04-11 16:53 UTC (permalink / raw)
  To: Steve Talley, zsh-users

On Apr 11, 10:18am, Steve Talley wrote:
}
} Unfortunately when I change the value of one I have to change all
} three.  Is it possible to tie the values together, so that after
} changing one they all get changed?

Not directly (though this sounds like a good basis for a zmodload
module of some kind).  The easiest thing is to use precmd() to force
two of them to always match the third, e.g.

	precmd() {
	    export JDKHOME=$JAVA_HOME
	    export JDK_HOME=$JAVA_HOME
	}

Then always change JAVA_HOME when you want to change all of them.

I believe recent versions of ksh have a syntax for specifying set/unset
callbacks on parameters, so zsh will probably pick up that feature before
long.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-04-11 16:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-04-11 16:18 Tying multiple environment variables together Steve Talley
2001-04-11 16:53 ` Bart Schaefer

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).