Skip to content

Instantly share code, notes, and snippets.

@jquast
Created March 2, 2022 20:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jquast/f8fad901a40e6a6269f7fa90d219bffe to your computer and use it in GitHub Desktop.
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
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