Re: Re: Modifying the environment
Jim Knoble <[email protected]>
| Newsgroups | gmane.compw.window-managers.windowmaker.user |
|---|---|
| Message-ID | <[email protected]> |
Circa 2005-06-15 dixit Glenn Morris:
: Vigil wrote:
:
: > Not without restarting X.
:
: Blast.
:
: > You can of course modify a shell's environment and start any X
: > programs from that.
:
: Sure. What tends to happen is, I modify the environment of my existing
: xterms, then some time later open a new one from the WM menu. The new
: one gets the old environment, leading to much fun and excitement when
: I forget I wanted to change the environment.
Several options:
(a) If you're using a genuine xterm, you can start them with the
'-ls' option, which causes the shell they start to be a "login"
shell. "Login" shells by definition read your ~/.profile (for
Bourne/Korn shells), ~/.login (for C shells), or ~/.bash_profile
or ~/.bash_login (for GNU Bash shells). Put the environment
settings in the appropriate file, or in a file "sourced"
(included using the '.' or 'source' command) by the appropriate
file.
(b) Some shells (notably bash, csh, tcsh, sometimes pdksh, maybe
zsh) read an "interactive" startup file as well, in which case
you may not have to change how you start your xterm or other
terminal window. Bash usually reads ~/.bashrc, csh and tcsh
read ~/.cshrc, and pdksh sometimes reads ~/.shrc or ~/.kshrc,
depending on how it was built and whether the ENV environment
variable is set (check the pdksh man page and search for "ENV"
for more info).
(c) Don't use applications directly. Write "wrapper" scripts which
set environment variables from a file (or directory) in your
home directory. For example, you could put your environment
settings in a file called ~/.environment.sh:
EDITOR=gvim
VISUAL="${EDITOR}"
Then, instead of calling gvim directly, you could write a
wrapper script called, say, 'Editor':
#!/bin/sh
. "${HOME}/.environment.sh"
${EDITOR} "$@"
Put this script somewhere on your path and make it executable.
Then use it whenever you need an editor. If you change your
~/.environment.sh file:
EDITOR=xemacs
VISUAL="${EDITOR}"
then the 'Editor' script will see the change the next time it's
run.
Good luck.
--
jim knoble | [email protected] | http://www.pobox.com/~jmknoble/
(GnuPG fingerprint: 809F:09B9:9686:D035:4AB0::9455:124B:0A62:DD6A:76D6)
.....................................................................
:"The methods now being used to merchandise the political candidate :
: as though he were a deodorant positively guarantee the electorate :
: against ever hearing the truth about anything." --Aldous Huxley :
:...................................................................:
_______________________________________________
INFO: https://windowmaker.org/lists/listinfo/wm-user
ARCHIVE: https://windowmaker.org/lists/archive/wm-user/
FAQ: http://windowmaker.org/faq.html