From 3ca13619e3b8abca9d8ed0b2ac46263e82fa2223 Mon Sep 17 00:00:00 2001 From: Francis Rowe Date: Sat, 13 Jun 2015 11:02:57 -0400 Subject: download script: use a standard style (compared to other scripts) --- diff --git a/download b/download index ba9b742..2c04732 100755 --- a/download +++ b/download @@ -22,30 +22,30 @@ [ "x${DEBUG+set}" = 'xset' ] && set -v set -u -e -download=./resources/scripts/helpers/download +download="./resources/scripts/helpers/download" programme="unknown" usage="./download programme" -availableprogrammes="$(ls $download/)" +availableprogrammes="$(ls ${download}/)" # User specified no or too few/many parameters if (( $# != 1 )); then - printf "$usage\n\n" - printf "possible values for 'programme':\nall:\n$availableprogrammes\n\n" + printf "%s\n\n" "${usage}" + printf "possible values for 'programme':\nall:\n%s\n\n" "${availableprogrammes}" printf "Example (download everything): ./download all\n" printf "Example (download coreboot): ./download coreboot\n\n" exit 1 fi -programme=$1 +programme="${1}" -if [ "$programme" = "all" ]; then - for programme in $availableprogrammes; do - $download/$programme +if [ "${programme}" = "all" ]; then + for programme in ${availableprogrammes}; do + ${download}/${programme} done -elif [ -f "$download/$programme" ]; then - $download/$programme +elif [ -f "${download}/${programme}" ]; then + ${download}/${programme} else - printf "Invalid programme. Available programmes are:\nall\n$availableprogrammes\n" + printf "Invalid programme. Available programmes are:\nall\n%s\n" "${availableprogrammes}" exit 1 fi -- cgit v0.9.1