BASH regex help

Chris F.A. Johnson cfaj-uVmiyxGBW52XDw4h08c5KA at public.gmane.org
Fri Apr 21 16:48:27 UTC 2006


On Fri, 21 Apr 2006, Neil Watson wrote:

> On Fri, Apr 21, 2006 at 12:11:04PM -0400, Chris F.A. Johnson wrote:
>
>>     Do you mean a-b or a-z? No capital letters?
>
> I mean a-z.  Still not working.

    Did you try the code I posted?

>        # Check for a proper url
>        if [[ $DOMAIN = *[!a-z0-9.]* ]] ; then
>                echo "Invalid URL  a-b, 0-9 and . allowed only."
>                exit 1
>        fi
>
>        # We must escape special characters
>        DOMAIN = ${DOMAIN//./\\.}
>
> Check 1 works.  The substitution returns and error (DOMAIN: command not
> found).

     Syntax error (my mistake in copying). That should be:

DOMAIN=${DOMAIN//./\\.}

-- 
    Chris F.A. Johnson                      <http://cfaj.freeshell.org>
    ===================================================================
    Author:
    Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list