I want to define a permanent environment variable to view the last text file in a folder. I added this line in .bashrc file:
export DUMMY="less foldername/`ls foldername/ | tail -n 1`"
The folder is like this:
foldername/
|_ file1
|_ file2
|_ file3
|_ file4
...
The problem is, whenever I use $DUMMY, it opens always the same file (e.g. file3) which is one of the last ones but not very recent one and it is not changing. What is my mistake?
Thank you