test for a pattern in sh?

Marius Gedminas marius at pov.lt
Sun Oct 11 18:44:08 UTC 2009


On Sun, Oct 11, 2009 at 02:14:12PM -0400, stan wrote:
> I need to do something like this:
> 
> if $VAR does not contain SV do something
> 
> I found some examples for patterm`n matching with case, but I'd reaher use
> an if here, if I can do pattern matching with it.
> 
> Is this possible?

You could contrive something with echo and grep, but the standard idiom
is to use case, and I suggest using it.

Marius Gedminas
-- 
I dont know about madness (and anyway, the little green martians dancing
around me tell me not to worry...), but I've implemented something not
unlike this just now.
	-- Peter Sabaini
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20091011/e5fbc7dc/attachment.sig>


More information about the ubuntu-users mailing list