Range

range

Generate a sequence of integers. Argument order follows Python's range(): [last] | [first last] | [first last step]. With one argument, generates 0..n-1. With two, generates first..last. With three, generates first..last stepping by step. Uses seq when available, otherwise falls back to a pure-shell implementation.

Arguments

  • $1 (int): Last value (exclusive) when only arg, or first value
  • $2 (int): Last value (inclusive) when two args given
  • $3 (int): Step size when three args given

Exit codes

  • 0: Always
  • 1: No arguments given

Output on stdout

  • One integer per line