[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: case modification won't work with pattern
From: |
Clark J. Wang |
Subject: |
Re: case modification won't work with pattern |
Date: |
Fri, 11 Mar 2011 12:09:04 +0800 |
On Fri, Mar 11, 2011 at 11:56 AM, Chris F.A. Johnson
<chris@cfajohnson.com>wrote:
>
> I suggested using parameter expansion with patterns in
> <http://lists.gnu.org/archive/html/bug-bash/2006-02/msg00020.html>:
>
> $ foo=bar
> $ echo ${foo^} ## Convert first character
> Bar
> $ echo ${foo^^} ## Convert all characters
> BAR
> $ echo ${foo^[a-m]} ## Convert first character that matches pattern
> Bar
> $ echo ${foo^^[a-m]} ## Convert all characters that match pattern
> BAr
>
>
This sounds more reasonable to me.
> --
> Chris F.A. Johnson, <http://cfajohnson.com/>
> Author:
> Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)
> Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
>
>
--
Clark J. Wang