dotfiles/.local/bin/scripts/latest

9 lines
281 B
Plaintext
Raw Normal View History

2021-11-25 12:20:13 +00:00
#!/bin/sh -e
# Displays the latest files in the given directory or pwd
2021-12-02 22:33:22 +00:00
test "$1" = "-a" && all=true && shift
for f in "${@:-PWD}"
do test $# -gt 1 && highlight "$f"
find "$f" -maxdepth 4 -type f -printf '%.16T+ %P\n' |
2021-12-02 22:33:22 +00:00
sort -r | $(test "$all" && echo "less" || echo "head")
done