linux-tutorial/codes/shell/文件操作/读文件.sh

13 lines
152 B
Bash
Raw Normal View History

2020-01-03 22:41:37 +08:00
#!/usr/bin/env bash
FILE=log.txt
count=1
cat ${FILE} | while read line
do
echo "$count: $line"
count=$[ $count + 1 ]
done
echo "Finished reading."