I want to find the latest logfile (.log extension) in a directory using a bash script.
At first my simple attempt worked ok
filename=`ls -t -c1 | head -1`
But when I admit that files other than logfiles could be found, this doesn't work because of wildcard expansion
filename=`ls -t -c1 *.log | head -1`
So I believe I have to read the ls command into an array or file, then process from there.