bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

repeated parameter expansion and param. exp. on prompt variables


From: Ami Fischman
Subject: repeated parameter expansion and param. exp. on prompt variables
Date: Sat, 14 Feb 2004 08:51:40 -0800
User-agent: Gnus/5.090017 (Oort Gnus v0.17) Emacs/21.3.50 (gnu/linux)

I have two questions:
1) Is it possible to apply ${VAR/PAT/SUB} style expansion to the escape
   sequences in PS1?  Specifically, I have some "standard" but long paths,
   and I'd like to have something like
   ${\w/\/my\/standard\/but\/long\/path/workdir} in my PS1, but that doesn't
   work.  Any ideas on how to substitute patterns in \w on the fly for each
   prompt display?

2) Suppose I have:
   export MYVAR=SomeLongText@SomeOtherLongText
   I'd like to "shorten" this for display with by abbreviating each
   component (on either side of the @ sign), but there are several
   possibilities for each component.  So I'd _like_ to do something like:
   SHORTVAR=${${MYVAR/SomeLongText/SLT}/SomeOtherLongText/SOLT}

So, both questions boil down to whether it's possible to do pattern
substitution on text NOT coming from an environment variable -- in the
first case the text comes from \w and in the second from another pattern
substitution.  

Thanks,
-- 
  Ami Fischman
  usenet@fischman.org






reply via email to

[Prev in Thread] Current Thread [Next in Thread]