Bash Scripting Help

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Kevin Brown
Date:  
New-Topics: Passing password to cvs [Was:Re: Bash Scripting Help]
Subject: Bash Scripting Help
Bryce C wrote:
> Hello all. I was wondering if anyone knew how to do an if statement in
> bash to see if results were returned? I want to write a bash script to
> run hourly that will grep my mailbox for a certain text if the results
> are different than the contents of another, previous output, then runn
> another command. Somethinng like:
>
> cat file|grep Text>/tmp/NewText.grep
> diff /tmp/NewText.grep /tmp/Text.grep
> if( diff returned anything ) ./runme
> mv /tmp/NewText.grep /tmp/Text.grep
>
> I just don't know what if switches are available (to use) in bash.
> Thank you.
>

Here's a sample bash script I wrote:

SIZE=`ls -l $HOME | grep tvguide.all.html | awk '{ print $5 }'`
GT=`expr $SIZE \> $MINSIZE`
if [ "$GT" -eq 1 ]
then
mv -f ./tvguide.all.html $DEST/tvguide.all.html
fi