APL/APL1.2/SCR1.2/TP08/mult_mat.sh

31 lines
437 B
Bash
Raw Normal View History

2021-11-30 15:07:19 +01:00
#!/bin/bash
if [[ $# -ne 2 ]]
then
echo "Usage: ./mult_mat.sh <NUM_ARG1> <NUM_ARG2>"
exit
fi
if [[ $1 -gt $2 ]]
then
echo "First argument must be less than second argument !!"
exit
fi
if [[ $1 -lt 0 ]]
then
echo "Arguments must be positive !!"
exit
fi
if [[ $2 -lt 0 ]]
then
echo "Arguments must be positive !!"
exit
fi
for ((i=$1;i<=$2;i++))
do
for ((f=$1;f<=$2;f++))
do
echo -ne "$((i*f))\t"
done
echo -e "\n"
done
exit