Regular expression inside case statement notworking

I have the following script:

For catching errors like:

But the regular expression ERROR*memory inside case doesn't seem to be working.
The output of bash -x scriptname is:

Please help

Remove the quotes:

ERROR*memory
1 Like

Thanks,works like a charm.
I need another help, now the script is unable to catch any new line matching the pattern

Is there any fundamental error in the script?

The output that passes through the pipe is buffered, I suppose you just need to wait until the buffer gets flushed ...
(just add some more lines and you should see the script working).

1 Like

Does ERROR.memory and ERRORmemory mean the same?

No, you're using shell pattern matching, not regular expressions. The dot ( . ) has no special meaning in shell pattern matching
(it just matches a literal dot).