[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Env Variables



On Sun, 25 Jun 2000, Patrick Dahiroc wrote:

PD> i set the environmental variable below to dynamically change my xterm
PD> window to title to the current working directory.
PD> 
PD> export PROMPT_COMMAND='echo -ne "\033]2;${USER}: ${PWD}\007"'
PD> 
PD> this works really well when i login in X, but when i login from the
PD> console my system beeps every time since \007 is the bell character.
PD> is the a variable i can check that would tell me whether i'm running
PD> from X or from the console, so i can conditionally set the
PD> PROMPT_COMMAND variable?

You could check the TERM variable and if it has something like 'xterm-16color'
then you set your prompt, if it has 'linux' in it, then you are in console, you
can check this in .bashrc or .cshrc or whatever is your favourite shell's
startup script.

                                                Dingo.


                                      ).|.(
                                    '.`___'.`
                                   ' `(>~<)' `
     -=-=-=-=-=-=-=-=-=-=-=-=-=-=-ooO-=(_)=-Ooo-=-=-=-=-=-=-=-=-=-=-=-=-
      Petr [Dingo] Dvorak                   dingo@pdragon.inetsolve.com
      Coder - Purple Dragon MUD         pdragon.inetsolve.com port 5555
     -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-[ 369D93 ]=-
      Just because you paranoid, it doesn't mean, they're not after you
     -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-



Reply to: