On Wed, 2006-07-12 at 06:22 -0600, Jonathan Duncan wrote:
> I just do not know the syntax.  I saw a list of "Exit Values" in the rsync 
> man page but how do I check for those?

If you don't care about the exact return code in event of an error, you
can include the rsync command in the if statement.

if rsync foo bar baz
then
  echo success
else
  echo failure
fi

If you care about the return code, immediately after running rsync, add
RC=$?
The variable $? contains the return code of the last command to execute.

if [ 0 -eq $RC ]
then
  echo "Shells are weird, 0 == success == true"
fi

Check the builtin bash help for test
help test
to find out about the various types of tests.

-- 
Stuart Jansen              e-mail/jabber: [EMAIL PROTECTED]
                           google talk:   [EMAIL PROTECTED]

"However beautiful the strategy, you should occasionally look at 
the results." -- Winston Churchill

Attachment: signature.asc
Description: This is a digitally signed message part

/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/

Reply via email to