Re: help with shell scripting!!
- From: Logan Shaw <lshaw-usenet@xxxxxxxxxxxxx>
- Date: Mon, 26 Mar 2007 19:39:23 -0500
SM Ryan wrote:
You need to give arguments the test command will recognises,
such -n string, properly quote the arguments, and you should space
the brackets. In bourne shell it would look like
if [ -n "`echo $y | grep errors`" ]
then
echo "errors found"
fi
Or, bypass the test operation completely and use the exit code of
grep to indicate whether the string was found:
if echo "$y" | grep errors > /dev/null
then
echo "errors found"
fi
Or use the expr command:
if expr "$y" : '.*errors' > /dev/null
then
echo "errors found"
fi
Or, as someone else said, use a case statement (the most efficient way).
- Logan
.
- References:
- help with shell scripting!!
- From: seema
- Re: help with shell scripting!!
- From: SM Ryan
- help with shell scripting!!
- Prev by Date: Re: Process Synchronization using Pipes
- Next by Date: char *** help
- Previous by thread: Re: help with shell scripting!!
- Next by thread: [Q]Unix extension lib for std:set like operation ?
- Index(es):
Relevant Pages
|