Created
February 27, 2012 00:40
-
-
Save aji/1920115 to your computer and use it in GitHub Desktop.
lastdl -- shell script to report the newest file in the downloads folder
This file contains 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/sh | |
# echoes the full path of the newest download | |
# usage: lastdl.sh [NN], where 1<=NN<100 | |
# adjust this appropriately: | |
DOWNLOADS=$HOME/Downloads | |
# this is horrendous | |
back=$1 | |
case $back in | |
[0-9]|[0-9][0-9]) ;; | |
*) back=1 ;; | |
esac | |
file=`ls -1t $DOWNLOADS | head -$back | tail -1` | |
echo $DOWNLOADS/$file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment