cabal, apt, dnf, pkg or brew install it locally right now.
#!/bin/bash # Return last file in dir last_offset=1 cmd= if [[ "$#" -gt 0 ]]; then if [[ "$1" =~ ^[0-9]+$ ]]; then last_offset="$1" shift else if which "$1"; then cmd="$1" shift fi fi fi fn="$(ls -rt "$@" | tail -"$last_offset" | head -1 | sed -e 's/ /\\ /g')" if [[ ! -f "$fn" ]]; then echo "lastf returned an entry that is not an actual file: $fn" >&2 fi if [[ "$cmd" != '' ]]; then "$cmd" "$fn" else printf '%s\n' "$fn" fi