简体   繁体   中英

Grab last line of 'cat' output without head, tail, sed or awk

I have a directory of files on an (older) Android device and want to cat the file that comes last in the file listing when I call ls . Now on my Linux computer I'd have no problem with that, I could just do

ls | tail -n 1

But on my phone, neither tail , nor head , sed , or awk are available. So what should I do?

尝试:

for a in *; do :; done; echo "$a"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM