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

Re: bash ${parameter%%patern} does not work ?



Thanks :-)  It can not get any clearer.

I must have been sleeping when reading documents. :-(

Osamu

On Mon, Jul 23, 2001 at 01:39:00PM +0200, Leonard Stiles wrote:
> Osamu Aoki <debian@aokiconsulting.com> writes:
> 
> > I have been scratching my head for bash parameter substitution.
> > 
> > I understand ## in following examples but I can not understand %%.
> > Is this how bash 2.0 supposed to work?
> 
> [examples deleted]
> 
> The examples you give do not really illustrate what exactly you don't
> understand about this form of parameter expansion.  The bash
> documentation is very good in this field anyway (see "man bash", or
> the texinfo docs in the bash-doc package).
> 
> Maybe this table helps demonstrate the difference between the four
> forms:
>                           match type
>                       |longest|shortest|
>                 ------+-------+--------+     
>                 start |  ##   |   #    |
> Anchor match to ------+-------+--------+
>                 end   |  %%   |   %    |
>                 ------+-------+--------+
> 
> In each case, if there is an appropriate match for the pattern in the
> value of the variable being expanded, then the matching string is
> removed from the value of the expansion, otherwise the value of the
> variable is returned as a whole.
> 
> e.g. ${PATH%%:*} returns the first directory in the path.
> 
> If you still don't understand something after reading the relevant
> parts of the documentation, post examples where bash behaviour
> deviates from what you expect, and explain what you though would
> happen.
> 
> -- 
> 
> Leonard Stiles <ljs@uk2.net>
> 
> 
> -- 
> To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> 
> 

-- 
~\^o^/~~~ ~\^.^/~~~ ~\^*^/~~~ ~\^_^/~~~ ~\^+^/~~~ ~\^:^/~~~ ~\^v^/~~~ 
+  Osamu Aoki <debian@aokiconsulting.com>, GnuPG-key: 1024D/D5DE453D  +
+  My debian quick-reference, http://www.aokiconsulting.com/quick/    +



Reply to: