help-bash
[Top][All Lists]
Advanced

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

Re: case insensitivity for some branch in the case statement


From: Peng Yu
Subject: Re: case insensitivity for some branch in the case statement
Date: Fri, 1 Nov 2019 16:46:54 -0500

This is cumbersome if the string is long. Is there anything like a switch
that just changes the case-sensitivity in a specific branch? Thanks.

On Fri, Nov 1, 2019 at 3:29 PM Eric Blake <address@hidden> wrote:

> On 11/1/19 8:12 PM, Peng Yu wrote:
> > Hi,
> >
> > I'd like to make some case-statement branch comparison
> > case-insensitive but not all. Is it possible with bash? Thanks.
>
> case $foo in
>    [aA][bB][cC]) # This branch is case-insensitive
>      ;;
>    bCd)  # This branch is case-sensitive
>      ;;
> esac
>
> --
> Eric Blake, Principal Software Engineer
> Red Hat, Inc.           +1-919-301-3226
> Virtualization:  qemu.org | libvirt.org
>
> --
Regards,
Peng


reply via email to

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