zsh-users
 help / color / mirror / code / Atom feed
* Scope of local parameters
@ 2003-05-01 17:20 Haakon Riiser
  2003-05-05  6:47 ` Borzenkov Andrey
  0 siblings, 1 reply; 6+ messages in thread
From: Haakon Riiser @ 2003-05-01 17:20 UTC (permalink / raw)
  To: zsh-users

Are there ways to limit the scope of local parameters besides
functions?  Say you want to colorize the prompt, and you use
helper variables for the color escape sequences:

  local RED=...
  local GREEN=...
  local BLUE=...

  PS1=<use RGB variables here>

If I do this in ~/.zshrc, or a file sourced by .zshrc, the
variables declared local do not disappear after sourcing ~/.zshrc.

One way to work around this is to wrap the PS1 initialization in
an auxiliary function, but then you have the same problem with
the scope of the function. :-)  Alternatively, one could

  unset RED GREEN BLUE

after setting PS1, but this doesn't feel quite right.  What if
the parameters RED GREEN BLUE already existed?  There has to be
a better way.

-- 
 Haakon


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

end of thread, other threads:[~2003-05-06 10:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-01 17:20 Scope of local parameters Haakon Riiser
2003-05-05  6:47 ` Borzenkov Andrey
2003-05-05  6:57   ` 'Haakon Riiser'
2003-05-05  7:37     ` Borzenkov Andrey
2003-05-05  8:06     ` Borzenkov Andrey
2003-05-06 10:04       ` Peter Stephenson

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