From 3344cdf0010271c43279dd99a9df151017dc1fff Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Fri, 19 Jul 2019 12:08:45 -0400 Subject: initial commit --- seq | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 seq (limited to 'seq') diff --git a/seq b/seq new file mode 100755 index 0000000..585087b --- /dev/null +++ b/seq @@ -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 -- cgit v1.2.1