bug-coreutils
[Top][All Lists]
Advanced

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

Re: comparing string with regular expression using test command in unix


From: Mike Frysinger
Subject: Re: comparing string with regular expression using test command in unix
Date: Mon, 20 Feb 2006 16:59:20 -0500
User-agent: KMail/1.9.1

On Friday 17 February 2006 05:23, N Gandhi Raja wrote:
> I want to compare a variable holding *string* with the *regular
> expression *. Is it possible to do in unix with a single command?
> Can we use "test" command in UNIX to compare a *string *with the
> *regular expression*? if so please provide an example for that.

`test` does not support regexes, but you can use either `expr` or bash-3.0+ 
supports regex comparison using the =~ operator
-mike




reply via email to

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