#!/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
bash中打印文件每一行及其行号
原文:https://www.cnblogs.com/alfredsun/p/10606518.html