SPUG: aliases, -> Korn Shell vs. PD-ksh

Brian Hatch spug at ifokr.org
Thu Jan 23 23:20:36 CST 2003



> By the way, my .kshrc it contains:
> 
> PS1="-->"

me:  
	PS1=

machine=`hostname |awk -F. '{print $1}'`
me=`whoami`
if [ -w / ] ; then
        PS1=$me@${machine}:'$PWD''
# '
        #remove dot from path
        export PATH=`echo $PATH | sed -e 's/:\.$//g'`
else
        export PATH
        PS1=$me@${machine}:'$PWD''
$ '
fi
unset me machine


Yields
	username at host:/the/current/path
	$

or 
	root at host:/the/current/path
	#

which is excellently suited for cut/paste when doing
'scp's and such.  Having a two line prompt also means
you can have an entire screen width for your command,
and still see where you are.

> The ^[ is an escape character and ^G is CTRL-G. This puts the path in the
> xterm title bar and keeps my prompt a nice constant "-->". 

But what happens when you ssh to another machine that
doesn't have this alias, or need to sudo to root and
it doesn't have it?  When you log out of that machine,
you need to run a gratuitious 'cd .' to fix your
title bar.

No, for me anything that changes my title bar should be
shot.  One of the reasons I don't use bash[1] since often
it has such an alias.

Besides, I like to label my title bars manually with
'retitle', which is pretty much similar to what you
had but without needing to imbed ctrl chars:
	
	function retitle {
	        echo '\033]0;'$@'\007\c'
	}

[1] To get us back to the bash vs ksh debate that started
    this thread[2]

[2] This thread being far diverged from perl, so I'm going
    to shut up before Tim starts having stick riddle
    flashbacks.

--
Brian Hatch                  Nothing is fool-proof
   Systems and                to a sufficiently
   Security Engineer          talented fool.
http://www.ifokr.org/bri/

Every message PGP signed
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 240 bytes
Desc: not available
Url : http://mail.pm.org/pipermail/spug-list/attachments/20030123/07fec1e4/attachment.bin


More information about the spug-list mailing list