Linux shell script practice (Jiujiushengfa formulas table)
1, create chengfa.sh script, run the script is written.
[root@localhost ~]# vim chengfa.sh
#!/bin/bash
for ((i=1;i<=9;i++))
do
for((n=1;n<=$i;n++))
do
echo -n " $i x $n = `expr $i \* $n` "
if [ $i -eq $n ];then
echo -e '\n'
fi
done
done
2, run the script
Thinking parsed: i is the first number, the second number is n, line displayed when n is equal to i.