blob: f13bdd928a6d653af7456d796e7a219f75e7b58b [file] [log] [blame]
#!/bin/sh
if [ $# -lt 2 ]; then
echo "usage: $0 <timeout> <filenames>\n Waits until any of the given files has been created or the timeout (in seconds) expires." >&2
exit 1
fi
TIMEOUT=$1
shift
wait-until-created "$@" &
PID=$!
(sleep ${TIMEOUT}; kill ${PID}) 2> /dev/null &
wait ${PID} 2> /dev/null