根据输入的选项显示行号:
#!/bin/bash
let linenum=0
while getopts ":n" A; do
case $A in
n)
  let linenum=1
;;
\?)
 echo "unknow"
;;
done

let i=1
while read line; do
if [ $linenum -eq 1 ];then
echo "$i $line"
let i++
else
echo "$line"
fi
done < /root/ipsh