1 #!/bin/bash
2
3 if [ $# -ne 1 ];then
4 echo parmeter must be 1
5 exit
6 fi
7
8 for ((i=1; i<$1; i++)); do
9 for ((j=1; j<=i; j++)); do
10 tput setaf $j
11 echo -ne "$j"X"$i"=$((i*j))" "
12 done
13 echo
14 done
如果参数不对,会显示如下
正确的命令是: