Printing a string value results not found

后端 未结 1 528
星月不相逢
星月不相逢 2020-12-20 10:41

When I run my script, there is no output to the terminal.

This my code:

for ((h = 1 ; h < 4 ; h++ )); do 
    x=$(awk -v i=h -v j=17 \'FNR == i {p         


        
相关标签:
1条回答
  • 2020-12-20 11:17

    You are saying:

    awk -v i=h -v j=17 ...
    

    Note i=h which is equivalent to saying: i=0.

    It seems that you wanted to say:

    x=$(awk -v i=$h -v j=17 'FNR == i {printf "%s ", $j}' newiptables.log)
                 ^
                 |== refer to the variable h
    
    0 讨论(0)
提交回复
热议问题