My factorial script:
#!/usr/bin/env sh
i=1 j=1 inc=1
case "$#" in
0) echo "no argument given"; exit 1 ;;
1) last=$1 ;;
2) i=$1 last=$2 ;;
*) i=$1 inc=$2 last=$3 ;;
esac
while [ "$i" -le $last ]; do
j=$((i*j)) i=$((i+inc))
done
echo "$j"
Compared to seq -s \* $i | bc
for i in {1..25}; do
Comment too long. Click here to view the full text.