ksh & perl approach to pruning long pwd prompts

Dave Corcoran dave at aspect.UUCP
Fri May 10 01:53:35 AEST 1991


In article <1991Apr25.122017.3868 at ttsi.lonestar.org>, root at ttsi.lonestar.org (System) writes:
> A recent spate of articles (in comp.unix.shell) about pwd style 

Which I missed so forgive me if this has been proposed.

> A really long path is shortened by successively pruning leading path 
> components until the length is less than a user-specified size.
> Pruned components are replaced with "..." as in

> Any suggestions for how to do this in ksh are welcome.  Likewise for
> improved perl code.

Although this will not limit of the prompt to a specified size it is terse.

PS1='${PWD#$HOME/}'

You could substitute $DIR for $HOME and then set DIR to the
leading path you want trimmed.
-- 
David Corcoran		      -@@
uunet!aspect!dave	        ~
Having the right to do something is not the same as being right in doing it.
					--  C.K. Chesterson



More information about the Comp.unix.shell mailing list