脚本如下:
#!/bin/bash for i in 'seq 1 9' do for j in 'seq 1 $i' do k=$[$i*$j] echo -ne "$j""X""$i=$k " done echo done
执行脚本:
sh cheng1.sh
上面代码执行会报错:
cheng1.sh: line 6: seq 1 9*seq 1 $i: syntax error in expression (error token is "1 9*seq 1 $i")
菜鸟一枚,第一次写shell脚本不懂语法,将" ` " 写成 " ' ",尴尬,最后改过来了,解决了问题;