Forgive me if this is a trivial question, but I haven't been able to find the answer to this.
Basically I've got a list of files in a particular directory that have the general form t_*.dat. (I have other files in the same directory as well).
Essentially what I want to do is obtain the name of the last modified file in this directory that start with t_* and use that name as a variable in my shell script.
I know that the following command will give me the file in a terminal
ls -altr t_* | tail -1
But how could I use the name of this file in a variable, say $filename.
(Later on, I want to use this filename to plot data using gnuplot.)
Thanks.