题解 | #打印空行的行号#
打印空行的行号
https://www.nowcoder.com/practice/030fc368e42e44b8b1f8985a8d6ad255
#!/bin/bash
if [ -f nowcoder.txt ]; then
lineno=1
while read line; do
if [ -z "$line" ]; then
echo $lineno
fi
lineno=$((lineno + 1))
done < nowcoder.txt
else
echo "File nowcoder.txt does not exist."
fi
