Last active
December 23, 2016 02:24
-
-
Save Wevah/7bd8dd2961a12f89b7d0360889f97719 to your computer and use it in GitHub Desktop.
Simple`dl` command for downloading a file to the current directory
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
# simple 'dl' command for downloading a file to the current directory | |
dl () { | |
if [ $# -eq 0 ]; then | |
echo -e 'usage: dl \033[4murl\033[0m [\033[4mfile\033[0m]'; | |
elif [ $# -eq 1 ]; then | |
parsed="$(basename $(echo -n "$1" | sed 's/\?.*$//'))"; #strip query string and fragment | |
curl -C - "$1" -o "$parsed"; | |
else | |
curl -C - "$1" -o "$2"; | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment