public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* How to repeat a bash shell script until success
@ 2017-07-14  0:16 Bryan Dunphy
  2017-07-14  1:12 ` Brian Inglis
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Bryan Dunphy @ 2017-07-14  0:16 UTC (permalink / raw)
  To: cygwin

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


--
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

^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: How to repeat a bash shell script until success
@ 2017-07-14 19:23 Kaz Kylheku
  0 siblings, 0 replies; 11+ messages in thread
From: Kaz Kylheku @ 2017-07-14 19:23 UTC (permalink / raw)
  To: cygwin

On 14.07.2017 10:34, Brian Inglis wrote:
> On 2017-07-14 11:07, Kaz Kylheku wrote:
>>   while ! program args ... ; do
>>     sleep 1
>>   done
> 
> Has everyone forgotten there is also an until loop, supported by at 
> least sh,
> dash, bash, [m]ksh:

I've forgotten that at least twice. (I don't remember the exact number 
of times.)


--
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

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-07-17 17:41 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-14  0:16 How to repeat a bash shell script until success Bryan Dunphy
2017-07-14  1:12 ` Brian Inglis
2017-07-14  5:31 ` Gary Johnson
2017-07-14 13:06   ` Gary Johnson
2017-07-14 17:07   ` cyg Simple
2017-07-15 18:40     ` Sorin Adrian Savu
2017-07-17 17:41       ` cyg Simple
2017-07-17 17:46     ` Ian Lambert via cygwin
2017-07-14 17:34 ` Kaz Kylheku
2017-07-14 19:20   ` Brian Inglis
2017-07-14 19:23 Kaz Kylheku

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).