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

猜你喜欢

转载自www.cnblogs.com/alfredsun/p/10606518.html