Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Jun 1997 17:25:56 +0200 (MET DST)
From:      Eivind Eklund <perhaps@yes.no>
To:        Branson Matheson <branson.matheson@ferginc.com>
Cc:        chat@FreeBSD.ORG
Subject:   Re: OS/2 users going to FreeBSD?  :-)
Message-ID:  <199706191525.RAA15226@bitbox.follo.net>
In-Reply-To: Branson Matheson's message of Thu, 19 Jun 1997 09:30:47 -0400 (EDT)
References:  <199706191239.IAA14178@gatekeeper.itribe.net> <Pine.NEB.3.96.970619091753.21140F-100000@toth.hq.ferg.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> > > set prompt="%h [%T] %B%n%b@%m:%B%.2%#%b "
> > > 255 [23:12] roberto@keltia:/build/ap2> 
> > > 
> > set prompt="%t %m %S %/ %s%"   
> > 8:37am animaniacs  /home/jamie %
> 
> while were at it ... for you zsh users ( and zsh is pretty cool if you
> havn't looked at it .. especially the =filename function )

zsh is _cool_, and not just if you're a bourne fan, as was was implied
earlier - I've found it a better shell overall than tcsh, after approx
5 years of using tcsh, and not being able to live in bash.  Things
that made me switch:

(1) Powerful filename expansion.  Pattern matching is almost the power
of find.
(2) You can write foreach statements on one line, storing it entirely
in the history buffer.
(3) The default setup isn't to mess up my history entries (which tcsh
without histlit do)
(4) I can control tab-completion for different commands fairly easily.
(5) TAB expands patterns to a list of filenames.

and otherwise no loss from tcsh.  (Well, .. isn't eligeble for
filename expansion - no added / by default.  Doesn't bother me, but I
know it bother some other people.)

> export HOST=`uname -n | awk -F. '{print $1}'`
> if [ "${TERM}" = "xterm" ] 
> then 
>         echo -n "ESC]2; ${LOGNAME}@${HOST}:${PWD} ^G" 
>         chpwd() { echo -n "ESC]2; ${LOGNAME}@${HOST}:${PWD} ^G" } 
>         export PS1="%n@%m %(#.#.>) "
> else 
>         export PS1="%n@%m:%~ %(#.#.>) "
> fi

Neat, but could be neater.  Here's the version I ended up with:

if [ "${TERM}" = "xterm" ] 
then 
        chpwd() { echo -n "\e]2; ${LOGNAME}@${HOST%%.*}:$(print -P %~) \007" } 
	chpwd
        export PS1="%B%n(%m)%#%b "
else 
        export PS1="%B%n(%m)%~%#%b "
fi

It do not mess up the HOST variable (using zsh substitution to strip
the hostname instead), can just be cut'n'pasted (inline special
characters are done using escapes), use the default prompting
character for zsh (~) instead of ">", and use homedir-matching for the
name in the title-bar - ie, /home/eivind will change to ~ for me,
~eivind for you.

Eivind,
trying to get more converts :)



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