SCR/SCR1.2/TP08/mult_mat.sh

25 lines
415 B
Bash
Raw Permalink Normal View History

2022-10-27 10:57:44 +02:00
#!/bin/bash
if [[ $# -lt 2 ]]
then
echo "Usage: $0 <NUM_ARG1> <NUM_ARG2>"
exit
fi
if [[ $1 -lt 0 || $2 -lt 0 ]]
then
echo "Arguments must be both positive!"
exit
fi
if [[ $2 -lt $1 ]]
then
echo "Argument 1 must be less than Argument 2!"
fi
for ((i=$1;i<=$2;i++))
do
for ((j=$1;j<=$2;j++))
do
echo -n $((i*j))
echo -ne "\t"
done
echo -e "\n"
done
exit