Linux shell script practice (Jiujiushengfa formulas table)

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

Here Insert Picture Description
Thinking parsed: i is the first number, the second number is n, line displayed when n is equal to i.

Published 43 original articles · won praise 56 · views 7921

Guess you like

Origin blog.csdn.net/weixin_42953006/article/details/103444527