You can use a counter variable to keep track of the current line number like this:

counter=0

while read -r line
do
    # Process the current line
    ((counter++))
done < jobid.txt

echo "Current line number: $counter"

This script will read each line from the jobid.txt file and increment the counter variable for each line. Finally, it will print the value of the counter variable which represents the current line number.

while read -r linedodone jobidtxt记录当前行数

原文地址: https://www.cveoy.top/t/topic/iGxG 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录