ls -t1 | head -n 1 will give me the latest updated file so I want to tail that latest updated file in shell. How do I do that?
Asked
Active
Viewed 1,635 times
0
Stephen Kitt
- 434,908
KhalDrogo
- 11
1 Answers
2
One possible solution is to open a subshell for the command you want to run and add the result of the command as the parameter of tail:
tail "$(ls -t1 | head -n 1)"
Tamas H.
- 90
-
Cool, Its works. Thank you – KhalDrogo Jun 06 '19 at 08:39