16 lines
427 B
Bash
Executable file
16 lines
427 B
Bash
Executable file
#!/bin/sh -e
|
|
# Lists the latest modified files in the given directory or pwd
|
|
# up to a depth of 4
|
|
count=5
|
|
case "$1" in
|
|
(-a) all=true; shift;;
|
|
(--) shift;;
|
|
(-*) args="$1 $2"; shift 2;;
|
|
([0-9]) count=$(expr $1 \* 10); shift;;
|
|
esac
|
|
|
|
for f in "${@:-$PWD}"
|
|
do test $# -gt 1 && { highlight "$f" || echo "$f"; }
|
|
find "$f" -maxdepth 4 $args -printf '%.16T+ %P\n' |
|
|
sort -r | $(test "$all" && echo "less" || echo "head -$count")
|
|
done
|