Skip to content

Instantly share code, notes, and snippets.

@inconvergent
Created June 4, 2019 18:34
Show Gist options
  • Save inconvergent/9ee73bf77c2a3a80add0cea8972f6f42 to your computer and use it in GitHub Desktop.
Save inconvergent/9ee73bf77c2a3a80add0cea8972f6f42 to your computer and use it in GitHub Desktop.
#!/bin/bash
here=`pwd`
dir=$1
if [ -z "$dir" ]
then
dir="."
fi
cd $dir
a=`ls -t | head -n 1`
cd $here
echo $dir/$a
@MitchRatquest
Copy link

lst() {
dir="${1:-.}" #by default its ".", else its $1
echo "${dir}$(ls -t "${dir}" | head -n 1)"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment