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?
1 Answer
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)"
-
Cool, Its works. Thank youKhalDrogo– KhalDrogo2019-06-06 08:39:50 +00:00Commented Jun 6, 2019 at 8:39