Created
March 2, 2022 20:44
-
-
Save jquast/f8fad901a40e6a6269f7fa90d219bffe to your computer and use it in GitHub Desktop.
zsh or bash function to show most recently modified file in current folder, or folder given
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function rfile { | |
base='' | |
[ -n "${1}" ] && base="$1"/ | |
ls -1rt ${1:-} | tac \ | |
| while read f | |
do [ -f "${base}$f" ] && echo ${base}$f && break | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment