Skip to content

Instantly share code, notes, and snippets.

@namikingsoft
Last active January 4, 2021 22:09
Show Gist options
  • Save namikingsoft/1810faacfdb1483aab11cbf20557f40d to your computer and use it in GitHub Desktop.
Save namikingsoft/1810faacfdb1483aab11cbf20557f40d to your computer and use it in GitHub Desktop.
Repeat seconds
TIMEOUT_UNIXTIME="$(($(date +%s)+10))"
while [ "$(date +%s)" -lt "$TIMEOUT_UNIXTIME" ]; do
echo test
done
# bash
$TIMEOUT_SECONDS=$((SECONDS+10))
while [ $SECONDS -lt $TIMEOUT_SECONDS ]; do
echo test
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment