how to get the last modified file . so that can use it as a argument in other commands i tried
unzip ls -ltr | tail -1
but this is not working
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
As you have the
zshtag in your question, here is a zsh specific solution:
First, put all entries (
*) in the current directory into an array
files, ordered (
o) by modification time (
* is a so-called globbing pattern,
(om) are called Glob Qualifiers, which have an own section in
man zshexpn with that title.
Now, you can use the first element of that array to reference the newest file
man zshparam for more info about arrays.