i have the next code:
files=$(lftp -u mgtwrk35,Unix11! sftp://illin634<<EOF
cd some_dir
ls | tail -1
EOF)
why does the code above work, but if i add to the ls function -tr like:
ls -tr | tail -1
it doesn't work and gives me the next message:
ls: invalid option -- t
ls: invalid option -- r
Thanks in advance for the answer
The
ls
in lftp is not the real thing. It's also named "ls" but does not support all the parameters you can find in the standardls
.find
lets you recursively list files.cls --sort=date
lets you sort by modification date.I don't know how to combine the two. There's a work-around mentioned by Nicolas Noble, which is to use
awk
to post-process the result offind
.