Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 02 Jan 2002 21:05:35 -0700
From:      Chris Fedde <chris@fedde.littleton.co.us>
To:        "J.S." <johann@broadpark.no>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: Shell prompt contest 
Message-ID:  <200201030405.g0345Zx30208@fedde.littleton.co.us>
In-Reply-To: <20020102150618.04ae22ff.johann@broadpark.no> 

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 2 Jan 2002 15:06:18 +0100  "J.S." wrote:
 +------------------
 | Let's see who has the prettiest one :-)
 | 
 | -- LET THE GAMES BEGIN!
 +------------------

It's not the prettiest thing around but it has some useful features for
me.

    case `uname` in
	BSD/OS | FreeBSD | Linux)
	    host=`hostname`
	    PS1="$host $ "
	    ;;
	HP-UX | SunOS)
	    host=$(hostname)
	    PS1=${host%%.*}' ${PWD##*/} $ '
	    ;;
    esac

    case $SHELL in
	*bash)
	    if expr X$TERM : Xxterm
	    then
		PS1='\[^[[1m\]\$ \t \u@$host:\w\[^[[0m\]\n'
		PS1="\[^[]0;$host^G\]$PS1"
	    fi

	;;
    esac

This generates a prompt that looks as follows.
$ 20:53:07 cfedde@boing.fedde.littleton.co.us:~

Yes there is a carrage return in it. And nothing on the "typing line".
It uses bold text in an xterm and it updates the window title with the
current host name.  The user@host:directory format provides ample cut and
paste fodder for scp, ftp, emails and the like.
The time stamp lets me keep track of how long some commands take.

--
    Chris Fedde

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200201030405.g0345Zx30208>