########################################################################
# #
# This software is part of the ast package #
# Copyright (c) 1989-2012 AT&T Intellectual Property #
# and is licensed under the #
# Eclipse Public License, Version 1.0 #
# by AT&T Intellectual Property #
# #
# A copy of the License is available at #
# (with md5 checksum b35adb5213ca9657e911e9befb180842) #
# #
# Information and Software Systems Research #
# AT&T Research #
# Florham Park NJ #
# #
# Glenn Fowler <gsf@research.att.com> #
# #
########################################################################
#
# seq.sh
# Written by David Korn
# AT&T Labs
# Sat May 5 00:32:40 EDT 2007
#
usage=$'\n[-?\n@(#)$Id: seq (AT&T Labs Research) 2012-04-14 $\n]
[+NAME?seq - print a sequence of numbers]
[+DESCRIPTION?\bseq\b writes the numbers from \afirst\a to \alast\a
in steps of increments. If \afirst\a or \aincr\a is omitted,
it defaults to 1. An omitted \aincr\a defaults to 1 even
when \alast\a is smaller than \afirst\a.]
[+?\afirst\a \aincr\a, and \alast\a are interpreted as floating
point values. \aincr\a is usually positive if \afirst\a is
smaller than \alast\a, and \aincr\a is usually negative
if \afirst\a is greater than \alast\a. When given, the
\aformat\a argument must contain exactly one of the
printf-style, floating point output formats \b%e\b, \b%f\b,
\b%g\b.]
[f:format]:[format:=%g?use printf style floating point \aformat\a.]
[s:separator]:[string:=\\n?use \astring\a to separate numbers.]
[w:equal-width?equalize width by padding with leading zeroes.]
[ first [ incr ] ] last
[+EXIT STATUS?]{
[+0?Success.]
[+>0?An error occurred.]
}
[+SEE ALSO?\bksh\b(1), \bprintf\b(3)]
'
;;
*)
usage=''
;;
esac
function err_exit
{
exit 1
}
{
typeset i
for i
do n=${#i}
[[ $i != *.* ]] && continue
i=${i##*.}
n=${#i}
done
print -r -- "%0$width.${precision}f"
}
command=${0##*/}
f)
;;
s)
w)
width=1;;
esac
done
case $# in
*) err_exit "too many arguments";;
esac
if [[ $width ]]
then end=$last
fi
elif [[ ! $fmt ]]
then fmt=%g
fi
s=
s=$sep
done
[[ $s ]] && print
exit 0