I have a log directory consisting of many log files, one log file is created after a system event occurs. I want to write an oneline bash script that always controls the list of files and displays the contents of the newly created file on the terminal. Here's what it looks like:
Currently, all I have is to display the contents of the entire directory:
for f in *; do cat $f; done
It lacks the monitoring function that I wanted. One of the limitations of my system is that I do not have a command watch . I also don't have a package manager to install fancy tools. Raw BSD is all I have. I have tail, I was thinking of something like tail -F $(ls)that, but it pushes each file instead of a list of files.
In conclusion, I want to modify my script so that I can control the contents of all newly created files.
source
share