seq (382B)
1 #!/bin/sh 2 3 case "$#" in 4 1) 5 last="$1" 6 ;; 7 2) 8 first="$1" 9 last="$2" 10 ;; 11 3) 12 first="$1" 13 incr="$2" 14 last="$3" 15 ;; 16 *) 17 echo "usage: seq <last>" 18 echo " seq <first> <last>" 19 echo " seq <first> <incr> <last>" 20 exit 1 21 ;; 22 esac 23 24 25 echo | awk -v "first=${first:-1}" -v "incr=${incr:-1}" -v "last=$last" ' 26 { 27 for (i=first; i <= last; i=i+incr) 28 print i 29 }'