Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #Description: Hace la tabla de multiplicar de un entero válido entre 1 y 10 ambos inclusive
- #Author:jMa
- number=`echo $1 | grep -x -q "[0-9]\+"`
- bien=$?
- if [ \( "$#" -gt "1" \) ] || [ \( "$bien" != "0" \) ] || [ \( "$1" -gt "10" \) ] || [ \( "$1" -lt "0" \) ]
- then
- echo "Has pasado más de un parámetro , o este no es un número o es menor que cero o mayor que 10"
- else
- for i in `seq 1 1 10`
- do
- let producto=$1*$i
- echo "$1 * $i = $producto"
- done
- fi
Advertisement
Add Comment
Please, Sign In to add comment