From: "Haakon Riiser" <haakon.riiser@fys.uio.no>
To: zsh-users@sunsite.dk
Subject: Scope of local parameters
Date: Thu, 1 May 2003 19:20:22 +0200 [thread overview]
Message-ID: <20030501172022.GA4179@s.chello.no> (raw)
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
next reply other threads:[~2003-05-01 17:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-01 17:20 Haakon Riiser [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030501172022.GA4179@s.chello.no \
--to=haakon.riiser@fys.uio.no \
--cc=zsh-users@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).