Last active
August 29, 2015 13:57
-
-
Save z-------------/9871747 to your computer and use it in GitHub Desktop.
My first dive into the world of shell scripting...
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 | |
| # download.sh <dir> <file1> <file2>... | |
| tempDir="$1" | |
| #make folder and cd to it | |
| mkdir $tempDir | |
| cd $tempDir | |
| #make array of arguments | |
| if [ "$#" -eq 0 ]; then | |
| echo "No arguments provided" | |
| else | |
| args=( "$@" ) | |
| fi | |
| #curl files | |
| for (( i=1; i<=$(( ${#args[@]} * 2 )); i++ )) | |
| do | |
| if [ ${#args[$i]} -gt 0 ]; then | |
| curl -O ${args[$i]} | |
| fi | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment