Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Scope of local parameters
- X-seq: zsh-users 6062
- From: "Haakon Riiser" <haakon.riiser@xxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Scope of local parameters
- Date: Thu, 1 May 2003 19:20:22 +0200
- Mail-followup-to: zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author