[plug] How to force a shutdown with reboot??

Cameron Patrick cameron at patrick.wattle.id.au
Tue Dec 30 13:43:46 WST 2003


On Tue, Dec 30, 2003 at 01:08:10PM +0800, Luke Dudney wrote:

| Ahh, the importance of a descriptive prompt, and $PROMPT_COMMAND for
| xterms! Won't save you every time, but "if it only saves you once a
| year..."

You can do the $PROMPT_COMMAND thing without the overhead involved in
having a $PROMPT_COMMAND - just stick it in $PS1.  The important bit is
to put \[...\] around the "magic" commands that don't actually display
on the screen, or readline gets a bit confused.  I also have different
coloured prompts for root and normal users...  From my .bashrc:

    alias ls='ls --color=auto -v -F '
    ANSI_GREY='\[\033[1;30m\]'
    ANSI_NORMAL='\[\033[0m\]'
    ANSI_GREEN='\[\033[0;32m\]'
    ANSI_RED='\[\033[0;31m\]'
    ANSI_YELLOW='\[\033[0;33m\]'
    ANSI_UNDERLINE='\[\033[4m\]'
    XTERM_PROMPT=""
    if [ "$TERM" = "xterm" ]; then
      XTERM_PROMPT="\[\033]2;\u@\h :: \w\a\]"
    fi
    if [ "$TERM" = "screen" -o "$TERM" = "screen-w" ]; then
      if [ "$USER" = "root" ]; then
        XTERM_PROMPT="\[\033k(ROOT)@\h:\w\033\134\]"
      else
        XTERM_PROMPT="\[\033k\h:\w\033\134\]"
      fi
    fi
    if [ "$TERM" = "emacs" ]; then
      ANSI_GREY=''
      ANSI_NORMAL=''
      ANSI_GREEN=''
      ANSI_RED=''
      ANSI_YELLOW=''
      ANSI_UNDERLINE=''
      alias ls='ls --color=never -v -F '
    fi
    if [ "$USER" = "root" ]; then
      USER_COLOUR="${ANSI_RED}"
      PATH_COLOUR="${ANSI_YELLOW}"
    else
      USER_COLOUR="${ANSI_GREY}"
      PATH_COLOUR="${ANSI_GREEN}"
    fi
    PS1="$XTERM_PROMPT$ANSI_GREY($USER_COLOUR\u@$ANSI_UNDERLINE\h$ANSI_NORMAL$PATH_COLOUR\W$ANSI_NORMAL$ANSI_GREY)$ANSI_NORMAL "

I'm not sure why I've got the TERM=emacs check, I haven't used emacs for
quite a while.

Cameron.




More information about the plug mailing list