bug-bash
[Top][All Lists]
Advanced

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

Re: capturing sub-expressions?


From: Paul Jarc
Subject: Re: capturing sub-expressions?
Date: Tue, 29 Jan 2008 13:41:13 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

Linda Walsh <bash@tlinx.org> wrote:
> In my copy of the man pages, Pattern matching is indented an extra
> level making it look like it's under Pathname Expansion and only
> applies there....

Pattern matching applies primarily to pathname expansion; other uses
explicitly refer to its use there:
       ${parameter/pattern/string}
              The pattern is expanded to produce a pattern just as in
              pathname expansion.  Parameter is expanded and the
              longest match of pattern against its value is replaced
              with string.  [...]

> I wanted to leave "myswitch2" as the only thing left in $p;

p=" $p "
p=${p/* myswitch2 */myswitch}
p=${p/ */}


paul




reply via email to

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