diff options
| author | Jakob Kaivo <jkk@ung.org> | 2019-07-19 12:08:45 -0400 |
|---|---|---|
| committer | Jakob Kaivo <jkk@ung.org> | 2019-07-19 12:08:45 -0400 |
| commit | 3344cdf0010271c43279dd99a9df151017dc1fff (patch) | |
| tree | c99b13905233c79a7f92277d7fe8196ff37546f2 /seq | |
initial commit
Diffstat (limited to 'seq')
| -rwxr-xr-x | seq | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -0,0 +1,30 @@ +# SYNOPSIS +# seq [OPTION]... LAST +# seq [OPTION]... FIRST LAST +# seq [OPTION]... FIRST INCREMENT LAST + +FIRST=1 +INCREMENT=1 + +if [ $# -eq 3 ]; then + FIRST=$1 + INCREMENT=$2 + LAST=$3 +elif [ $# -eq 2 ]; then + FIRST=$1 + LAST=$2; +elif [ $# -eq 1 ]; then + LAST=$1 +else + printf 'use one of:\n' + printf '\tseq LAST\n' + printf '\tseq FIRST LAST\n' + printf '\tseq FIRST INCREMENT LAST\n' + exit 1 +fi + +i=$FIRST +while [ $i -lt $LAST ]; do + printf '%d\n' $i + i=$((i + INCREMENT)) +done |
