开发者

resetting value of a local variable

I am using a local variable record in a for loop like

record=$(awk 'NF!=4 {print $0}' n20${i})

but everytime instead of taking a new value it appends last value to new value. How can I solve my problem? Thanks in adv开发者_JS百科ance.


record=$(awk 'NF!=4 {print $0}' n20$((i++)))

That will increment the value of i each time the line is executed.

Or if you just want i+1 without changing the value of i:

record=$(awk 'NF!=4 {print $0}' n20$((i+1)))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜