Skip to content

Instantly share code, notes, and snippets.

@jimCresswell
Last active December 23, 2015 12:29
Show Gist options
  • Select an option

  • Save jimCresswell/6635294 to your computer and use it in GitHub Desktop.

Select an option

Save jimCresswell/6635294 to your computer and use it in GitHub Desktop.
Simple sh for loop script taking an optional number of loops argument
#!/usr/bin/env sh
# Parse input
if [ "$#" -gt "0" ]
then
NUMLOOPS=$1
else
NUMLOOPS=10
fi
# Run tests
for ((i = 1; i <= $NUMLOOPS; i++))
do
echo $i
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment