This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: How to repeat a bash shell script until success
- From: Brian Inglis <Brian dot Inglis at SystematicSw dot ab dot ca>
- To: cygwin at cygwin dot com
- Date: Thu, 13 Jul 2017 19:12:35 -0600
- Subject: Re: How to repeat a bash shell script until success
- Authentication-results: sourceware.org; auth=none
- References: <97021E71-D804-42AF-8358-6276AF4514AB@gmail.com>
- Reply-to: Brian dot Inglis at SystematicSw dot ab dot ca
On 2017-07-12 09:35, Bryan Dunphy wrote:
> 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:
>
> #!/bin/bash
> if ls /Volumes/Shared >/dev/null 2>/dev/null
> then
> rsync -avz --compress-level=9 --delete-during --partial --exclude 'cache/' \
> aleph.gutenberg.org::gutenberg /Volumes/Shared/Project-Gutenberg
> exit 0
> else
> exit 1
> fi
Plug your subject line into a web search and read the resulting hits.
Then you don't have to wait 9 hours for hints. ;^>
You could also run "man bash" and RTFM.
--
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada
--
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