Re: brace expansion and ksh?

Woodchuck <[email protected]> Fri, 12 Oct 2007 00:57:53 -0400 (EDT)
Newsgroups gmane.os.netbsd.help
Message-ID <[email protected]>
On Fri, 12 Oct 2007, George Abdelmalik wrote:

> On Friday 12 October 2007 12:14, Jeremy C. Reed wrote:
> >
> > I have ${PWD} in my PS1 so long current directories make it so I can't
> > even see what I am typing. It is very inconvenient.
> 
> I too find it a little annoying. I often hit this issue with the configure 
> line of packages which have many --enable or --with options. Never been 
> bothered enough by it to try an fix it myself but would appreciate it very 
> much if it was. If you come up with a patch that you'd like someone to try 
> out then I'd be happy to.
> 
> -
> george.


This little snippet in /etc/ksh.kshrc seems to work:

        #PROMPT="<$USER@$HOST:!>$PS1S"
        PPROMPT='$USER:$PWD:!'"$PS1S"
        #PPROMPT='<$USER@$HOST:$PWD:!>'"$PS1S"
+       PPROMPT='[${USER}@${HOST} `basename $PWD`]'"$PS1S"
        PS1=$PPROMPT

i.e. add the line with the +   Mind the quotes.

It attempts to mimic PS1="[\u@\h \W]\$ "

demo:

[root@jennifer root]# 
[root@jennifer root]# echo $KSH_VERSION
@(#)PD KSH v5.2.14 99/07/13.2
[root@jennifer root]# cd /usr/pkgsrc/shells/pdksh/work/pdksh-5.2.14/
[root@jennifer pdksh-5.2.14]# cd
[root@jennifer root]# 
[root@jennifer root]# uname -a
NetBSD jennifer.chuck 3.1_STABLE NetBSD 3.1_STABLE (GENERIC.MP.CGD) #5: Fri May 11 14:20:00 EDT 2007  [email protected]:/usr/src/sys/arch/i386/compile/GENERIC.MP.CGD i386
[root@jennifer root]#

Dave
-- 
      You don't have to like businessmen to like capitalism.