001、
[root@pc1 test1]# ls a.txt [root@pc1 test1]# a=4 ## 定义变量a [root@pc1 test1]# cat a.txt 1 [root@pc1 test1]# awk '{for(i = 1; i <= "'$a'"; i++) print "xx"}' a.txt ## 直接引入变量 xx xx xx xx
。