#! /bin/bash # # until loop example - until is very similar to while (any until loop # can be easily converted to a while loop) # # this script will attempt to copy the first argument to the second argument # and will keep trying every 3 seconds until it succeeds # # read it as "Do statements until command runs correctly" # # until command; do # statements... # done # until cp $1 $2 2> /dev/null ; do echo "Attempt to copy failed. waiting... (hit Control-C to exit)" sleep 3 done