Skip to content

Instantly share code, notes, and snippets.

@shiumachi
Created November 28, 2018 06:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shiumachi/3edfddf7ffc6828882dc4c03cfe0aadf to your computer and use it in GitHub Desktop.
Save shiumachi/3edfddf7ffc6828882dc4c03cfe0aadf to your computer and use it in GitHub Desktop.
#!/bin/bash
# utility functions
# wait_seconds N
# sleep N seconds
#
function wait_seconds()
{
func_name="wait_seconds"
if ! expr "$1" : '[0-9]*' > /dev/null ;
then
echo "${func_name} ERROR: argument is not number" >&2
return
fi
for i in `seq $1`; do
echo "wait for `expr $1 + 1 - ${i}` seconds..." >&2
sleep 1
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment