diff options
-rwxr-xr-x | download | 21 |
1 files changed, 10 insertions, 11 deletions
@@ -24,20 +24,18 @@ set -u -e download=./resources/scripts/helpers/download -availableprogrammes=$(ls ${download}/) +programmes="none" case ${@} in all) - for programme in ${availableprogrammes}; do - ${download}/${programme} - done + programmes=$(ls ${download}/) ;; list) - printf "possible values for 'programmes':\nall:\n%s\n\n" "${availableprogrammes}" + printf "possible values for 'programmes':\nall:\n%s\n\n" "${programmes}" ;; help) printf "%s\n\n" "./download programme(s) # programmes are space separated, if specifing multiple programmes" - printf "possible values for 'programmes':\nall:\n%s\n\n" "${availableprogrammes}" + printf "possible values for 'programmes':\nall:\n%s\n\n" "${programmes}" printf "Example (download everything): ./download all\n" printf "Example (download flashrom): ./download flashrom\n" printf "Example (download coreboot): ./download coreboot\n" @@ -46,11 +44,12 @@ case ${@} in ;; *) for programme in ${@}; do - echo ${availableprogrammes} | grep -wq ${programme} || (printf "ERROR: Invalid programme '${programme}'. See ./download help.\n"; exit 1) - done - for programme in ${@}; do - ${download}/${programme} + echo ${programmes} | grep -wq ${programme} || (printf "ERROR: Invalid programme '${programme}'. See ./download help.\n"; exit 1) done + programmes=${@} ;; esac -# ------------------- DONE ---------------------- + +for programme in ${programmes}; do + ${download}/${programme} +done |