Re: Reintroducing fish, the friendly interactive shell
- From: "liljencrantz@xxxxxxxxx" <liljencrantz@xxxxxxxxx>
- Date: 9 Mar 2006 17:06:16 -0800
William Park skrev:
liljencrantz@xxxxxxxxx <liljencrantz@xxxxxxxxx> wrote:
Universal variables:
Since the dawn of time, clueless users have asked questions like 'how
can I change an environment varible in another running process?' The
answer has always been variations of 'You don't.' No longer so in fish.
Fish supports universal variables, which are variables whose value is
shared between all running fish instances with the specified user on
the specified machine. Universal variables are automatically saved
between reboots and shutdowns, so you don't need to put their values in
an init file. Universal variables have the outermost scope, meaning the
will never get used in preference of shell-specific variables, which
should minimize security implications.
Universal variables make it much more practical to use environment
variables for configuration options. Youy simply change an environemnt
variable in one shell, and the change will propagate to all sunning
shells, and it will be saved so that the new value is used after a
reboot as well. One example of environemnt variables in action can be
had by launching two fish instances in separate terminals side-by-side.
The issue the command 'set fish_color_cwd blue' and the color of the
current working directory element of the prompt will change color to
blue in both shells. Using universal variables makes it much more
convenient to set configuration options like $BROWSER, $PAGER and
$CDPATH.
What if you want to isolate one instance from the rest of Fish
instances? Can you specify the normal behaviour of shell?
Yes. When setting a variable (using the 'set' builtin command) you can
always manually specify a scope, so if you set the scope to global (-g)
when defining the value of a variable that already exists in the
universal scope, then that new value will be assigned to a global
variable with the same name and the universal variable is never
touched, and since global variables override universal variables, that
one shell will have a different value than all others.
If you do not specify a scope, then the scope of the innermost existing
variable is assumed. If no variable currently exists, then
function-local scope is assumed in a function, or global scope, if not
in a function.
--
William Park <opengeometry@xxxxxxxx>, Toronto, Canada
ThinFlash: Linux thin-client on USB key (flash) drive
http://home.eol.ca/~parkw/thinflash.html
BashDiff: Super Bash shell
http://freshmeat.net/projects/bashdiff/
--
Axel
.
- References:
- Reintroducing fish, the friendly interactive shell
- From: liljencrantz@xxxxxxxxx
- Re: Reintroducing fish, the friendly interactive shell
- From: William Park
- Reintroducing fish, the friendly interactive shell
- Prev by Date: Re: Reintroducing fish, the friendly interactive shell
- Next by Date: Alias to execute scripts with extension?
- Previous by thread: Re: Reintroducing fish, the friendly interactive shell
- Next by thread: uniq
- Index(es):
Relevant Pages
|