On Fri, Sep 07, 2001 at 11:43:14AM -0400, Bernie Cosell wrote:
> Well, many moons ago, I wanted to do a similar thing, only I needed 
> something different: I use a lot of shell variables to 'shortcut' to here 
> and there in the system [$temp, $perl, $scripts, $news, etc].  What I 
> wanted was that *IF* my current PWD had a prefix that matched some 
> variable in my environment, THEN: I wanted to have my prompt look like:
>    $perl/newclient
> or
>    $scripts/backup/

I'm sure this can be shortened.

pwd|perl -lpe'$ENV{PWD}=a;($p&&s/^\Q$p/\$$n/&&next)while($n,$p)=each%ENV'


 .robin.

Reply via email to