i need to read the last line in a txt file

i'm a beginner in shell and i have a txt file that is updating every second or msec so i need a program to read the last line of this txt file
is this possible to do?

tail -1 myfile

will output the last line in myfile

Alternately, if u want to see the file updates while excuting the tail add -f to the tail command. Like

#tail -f <file name>

thanks,

i forget to say after checking the last line the number in the last line i want to use it, for example let's say that the txt file contains:

1
2
1
4
6
1

so the last line contains 1 and i want to use this number

myval=`tail -1 myfile`

or

myval=$(tail -1 myfile)

in some flavors of unix

The POSIX spec for tail uses the syntax:

tail -n1 FILE

Apart from a brief time when the GNU version only accepted the POSIX syntax, the older syntax will work in all versions.