Dotfiles, utilities, and other apparatus.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

32 lines
523 B

#!/bin/sh
set -e
if [ -z "$1" ]; then
# default to current working directory:
dir="."
else
dir="$1"
fi
# if we got a directory as first param, cd there first:
if [ -e "$dir" ]; then
if [ -d "$dir" ]; then
cd "$dir"
else
echo "Not a directory: $dir"
exit 1
fi
else
echo "No such path: $dir"
exit 1
fi
# probably GNU-dependent
# list (A)lmost all files in
# current dir, sorted by (t)ime,
# and return the first (newest):
basename=$(ls -At | head -1)
# get full path:
readlink -f "$basename"