[oclug] password mode

Joe Burpee jeb at burkby.com
Sun Nov 16 13:20:58 EST 2003


On Sun, Nov 16, 2003 at 12:30:12 -0500, Robert Echlin wrote:
> I am running them in a for loop, so that the invocation of rsync differs 
> only in the name of the target machine. It's about 40 characters long, 
> so I don't want to have to eyeball two invocations to see if I changed 
> them both in the same way when I do make changes.
> I think I actually need to use &# or whatever it is to check the results 
> of each invocation of rsync, then break out of the for loop. I have a 
> couple of references on my desk, so it will be a piece of cake when I go 
> back to it. I just didn't think of it at the time.

You can do it with "$?" (man bash) but for your case I think the easiest
might be:

for HOST in ...; do
  rsync ... $HOST ... || break
  done

Joe



More information about the OCLUG mailing list