Situation: I want a one line command that can pull out the latest log (updates hourly), and watch as it changes. Here's an attempt that might explain less obscurely:
tail -500f $(ls | grep PackageName | sort | tail -1)
The above approach works actually, however when I create an alias for it, it doesn't update the $(~~~) value. Can anyone suggest a reason for it?
So, another attempt (the point of this question):
ls | grep PackageName | sort | tail -1 | tail -500f (LogFileNameTimeStampLatest)
Turns out it just outputs the result from last pipe (LogFileNameTimeStampLatest). And it makes sense as well, because that's what the 2nd last pipe command (tail -1
was doing in the first place)
I wanted to understand how would one use the output from last pipe to point to a file in the next pipe (and not just the LogFileName). Concretely, how would one use an output of one pipe as an argument for another pipe?