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

Shell prompts (was Re: floppy permissions)



on Wed, Apr 18, 2001 at 01:48:15AM -0400, Rob Mahurin (robm@mad.scientist.com) wrote:
> On Tue, Apr 17, 2001 at 11:06:33AM -0700, JC Portlock wrote:
> > YOU ARE ROOT!! on jchammin
> > /mnt pts/4> chmod 777 floppy
> 
> It's a shame that you've solved your problem; now I don't have an
> excuse to tell you that this is a great root prompt.

Not half bad.  My own approach is slightly more subtle, but reasonably
effective:

    function proml
    {
    case $TERM in
	xterm*|rxvt|eterm|wterm)
	    local TITLEBAR='\[\033]0;\u@\h:\w\007\]'
	    ;;
	*)
	    local TITLEBAR=''
	    ;;
    esac

    PS1="${TITLEBAR}\
    [\[\033[7m\]\u\[\033[0m\]@\h:\W]\
    \$ "
    PS2='> '
    PS4='+ '
    }

    proml
    unset proml
    export PS1

This results in a highlighted prompt for root (the escape sequences),
while my standard prompt is just plaintext.

Adapted from the BootPrompt mini Howto.

-- 
Karsten M. Self <kmself@ix.netcom.com>    http://kmself.home.netcom.com/
 What part of "Gestalt" don't you understand?       There is no K5 cabal
  http://gestalt-system.sourceforge.net/         http://www.kuro5hin.org

Attachment: pgpmfnbFNjCQP.pgp
Description: PGP signature


Reply to: