如何使用 Bash 将文本文件的最后一行读入变量?
How to read the last line of a text file into a variable using Bash?
我想读取一个名为 history.txt 的文本文件,其中包含多行并将最后一行的内容存储到一个名为 "tag".
的变量中
谢谢
tag=$( tail -n 1 history.txt )
cat FileName | while read oneline
do
echo "a oneline: $line"
done
我想读取一个名为 history.txt 的文本文件,其中包含多行并将最后一行的内容存储到一个名为 "tag".
的变量中谢谢
tag=$( tail -n 1 history.txt )
cat FileName | while read oneline
do
echo "a oneline: $line"
done