bash中打印文件每一行及其行号

  

#!/bin/bash
linenumber=$(cat remoteIP.cfg |wc -l)
currentline=0
for ip in $(cat remoteIP.cfg)
do
        currentline=$[$currentline+1]
        echo "linenumber:$currentline value:$ip"
done

 

posted @ 2019-03-27 11:49  夜歌乘年少  阅读(769)  评论(1编辑  收藏  举报