#!/bin/sh
# This is a very stupid shell script to replace "seq"
# for the rescan-scsi-bus script in the installer.
# Patrick Volkerding can be blamed for this.

# Usage: seq <start number> <end number>
#
# For example, "seq 3 5" would output:
# 3
# 4
# 5

BEGIN=$1
END=$2
if [ -z "$BEGIN" -o -z "$END" ]; then
  # Exit, beginning number and ending number not specified.
  exit 1
fi

# Make sure these are actually numbers:
BEGIN=$(expr $BEGIN + 0)
END=$(expr $END + 0)

# If the ending number is smaller, bail:
if test $BEGIN -gt $END ; then
  exit 1
fi

# Print the sequence:
# Start with another bad possibly infinite loop  :-)
echo $BEGIN
NUMBER=$BEGIN
while [ 0 ]; do
  if [ "$NUMBER" = "$END" ]; then
    exit 0
  fi
  NUMBER=$(expr $NUMBER + 1)
  echo $NUMBER
done

