Web lists-archives.com

How to repeat a bash shell script until success

I have a shell script, originally created for Mac OS X. that waits for an external drive to be mounted (by testing an “ls” of the volume’s root directory for success) then runs an “rsync”
 command. How do I get the script to be run repeatedly until successful exit under Cygwin?

Here is the unmodified Mac OS version of the script:

if ls /Volumes/Shared >/dev/null 2>/dev/null
        rsync -avz --compress-level=9 --delete-during --partial --exclude 'cache/' aleph.gutenberg.org::gutenberg /Volumes/Shared/Project-Gutenberg
        exit 0
        exit 1

Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple