Use stdout as argument of next command

I want to tail -f a log file. The application dynamicall names its log files using the date, so each time the app is run the log file looks something like "myapp-2008-01-18-18-29-17-686.log". There are many log files, but I know I just want to tail the last one. I have taken this approach to discover which is the latest:

$ ls -trC1 myapp*.log | tail -1

That displays to stdout the file I am interested in. I cannot figure out if it is possible to somehow pipe that or redirect it somehow as the ARGUMENT of another tail -f command. This does NOT work because the last tail command is just tailing stdin:

$ ls -trC1 myapp*.log | tail -1 | tail -f

Any ideas? I'm open to other suggestions, but I'd like to keep it simple and do it in one line instead of a script...
EarthwormAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kent OlsenDBACommented:
Hi Earthworm,

Piece of cake.  :)

tail -f ` ls -trC1 myapp*.log | tail -`


Good Luck,
Kent
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
TintinCommented:
Or a shorter version

tail -f `ls -t mpapp*.log | head -1`
0
EarthwormAuthor Commented:
Thanks, I knew it would be easy!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.