I am creating a logfile from kermit named the current date (which is in the format of DD MMM YYYY - which can not be changed AFAIK), and using the file name as today's date.
I then have a Bash script to read the file and I want to tail -n1
the file.
if I do
filename=$(date +%d\ %b\ %Y) && echo $filename
I get
23 Feb 2015
which is what I want and expect. However if I then do
filename=$(date +%d\ %b\ %Y) && tail -n1 $filename
I get
tail: cannot open `23' for reading: No such file or directory
tail: cannot open `Feb' for reading: No such file or directory
tail: cannot open `2015' for reading: No such file or directory
I am not sure what is causing this, probably down to the the way I have string formatted I guess since I get the same if I use tail
or cat
?
tail
to give these errors and how do I solve this?" than to ask for me specifically to offer assistance (I'm not always online, nor do I know everything). – anyone Feb 24 '15 at 15:45