I want to read a text file called history.txt that contains multiple lines and store the content of the last line into a variable called "tag".
Thanks
tag=$( tail -n 1 history.txt )
cat FileName | while read oneline
do
echo "a oneline: $line"
done
来源:https://stackoverflow.com/questions/42987486/bash-reading-the-last-line-of-a-text-file-into-a-variable