shell脚本如何获取一个文件的行数赋值给一个变量

2024-11-26 04:42:18
推荐回答(2个)
回答(1):

line=`sed -n '$=' myfile.txt`
echo $line

回答(2):

NUM= `cat file|wc -l`