I'm trying to make a small script which watches the latest log file in a folder and grabs the chat from the log, which i'll then display in a tmux panel but for some reason it can't find the file while it does exist
FILENAME=server_logs/$(ls -t1 server_logs | head -n 1)
watch -n3 'grep "\] " '$FILENAME' | tail -n15'
When i run the file it gives me this grep: server_logs/server_log_09_18_12.txt : No such file or directory
But if i use watch -n3 'grep "\] " server_logs/server_log_09_18_12.txt | tail -n15'
it does work.
So my question is why can't it find the file?