Re: Re: Modifying the environment

Norm Finlay <[email protected]>
Newsgroups gmane.compw.window-managers.windowmaker.user
Message-ID <[email protected]>
Thanks Jim.  This reply is one for my scrap-book of useful unix wisdom!

-Norm Finlay
Brandon University

Jim Knoble wrote:
> 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.
> 
_______________________________________________
INFO: https://windowmaker.org/lists/listinfo/wm-user
ARCHIVE: https://windowmaker.org/lists/archive/wm-user/
FAQ: http://windowmaker.org/faq.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.