Developpement/23SCR/SCR08/mult_mat.sh

32 lines
454 B
Bash
Executable File

#!/bin/bash
if [[ $# -lt 2 ]]
then
echo " Usage : $0 <NUM_ARG1> <NUM_ARG2>"
exit
fi
if [[ $1 -lt 0 ]]
then
echo " Arg1 must be positive ! "
exit
fi
if [[ $2 -lt 0 ]]
then
echo " Arg2 must be positive ! "
exit
fi
if [[ $1 -gt $2 ]]
then
echo " Arg1 must be less than Arg2 !"
exit
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