Created
June 4, 2019 18:34
-
-
Save inconvergent/9ee73bf77c2a3a80add0cea8972f6f42 to your computer and use it in GitHub Desktop.
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
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
lst() {
dir="${1:-.}" #by default its ".", else its $1
echo "${dir}$(ls -t "${dir}" | head -n 1)"
}