Changeset 23426 for issm/trunk-jpl/scripts/download_external_package.bash
- Timestamp:
- 10/15/18 18:45:13 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/scripts/download_external_package.bash
r23418 r23426 1 1 #!/bin/bash 2 2 # 3 # download_external_package.bash 4 # Generally, used to download a hosted file from a URL 5 # URL - Location of file to download 6 # file - File to write to (including path) 7 # usage: download_external_package.bash URL file 3 8 4 9 ## Constants 5 10 # 6 ERR_NO_GET_CMD="No supported file download command was found" 7 ERR_NUM_ARGS="Illegal number of args" 8 ERR_USAGE="" 11 MSG_ERR_NO_GET_CMD="No supported file download command was found" 12 MSG_USAGE="usage: $(basename ${0}) [-h] URL file 13 URL : Location of file to download 14 file : File to write to (including path)" 9 15 10 16 ## Variables … … 13 19 URL="" 14 20 15 ## Check number of args 21 ## Check that number of args is 2 (note that this also handles case where user 22 # explicitly requests help) 16 23 # 17 24 if [ $# != 2 ] 18 25 then 19 echo $ERR_NUM_ARGS 26 echo "$MSG_USAGE" 27 exit 0 20 28 fi 21 29 … … 37 45 if [ ! -z `which wget` ] 38 46 then 39 wget -- no-check-certificate-O $OUT_FILE $URL47 wget --quiet -O $OUT_FILE $URL 40 48 elif [ ! -z `which curl` ] 41 49 then 42 curl $URL -o $OUT_FILE50 curl --silent $URL -o $OUT_FILE 43 51 else 44 echo $ ERR_NO_GET_CMD52 echo $MSG_ERR_NO_GET_CMD 45 53 exit 0 46 54 fi
Note:
See TracChangeset
for help on using the changeset viewer.