diff --git a/currency/currency b/currency/currency index bb55aec..307520e 100755 --- a/currency/currency +++ b/currency/currency @@ -4,6 +4,15 @@ base="" exchangeTo="" currentVersion="1.2.0" + +checkCurl() +{ + if ! command -v curl &>/dev/null ; then + echo "Error: this tool requires 'curl', please install it." + return 1 + fi +} + ## Grabs the base currency from the user and validates it with all the possible currency ## types available on the API and guides user through input (doesnt take in arguments) getBase() @@ -184,6 +193,7 @@ usage() echo " -v Get the tool version" } +checkCurl || exit 1 checkInternet || exit 1 # check if we have a valid internet connection if this isnt true the rest of the script will not work so stop here while getopts "uvh" opt; do diff --git a/movies/movies b/movies/movies index 5d29913..d2b9a49 100755 --- a/movies/movies +++ b/movies/movies @@ -3,6 +3,15 @@ currentVersion="1.2.0" + +checkCurl() +{ + if ! command -v curl &>/dev/null ; then + echo "Error: this tool requires 'curl', please install it." + return 1 + fi +} + checkInternet() { echo -e "GET http://google.com HTTP/1.0\n\n" | nc google.com 80 > /dev/null 2>&1 # query google with a get request @@ -103,6 +112,7 @@ usage() echo " -v Get the tool version" } +checkCurl || exit 1 checkInternet || exit 1 # check if we have a valid internet connection if this isnt true the rest of the script will not work so stop here while getopts "uvh" opt; do diff --git a/stocks/stocks b/stocks/stocks index fd81966..883a25e 100755 --- a/stocks/stocks +++ b/stocks/stocks @@ -3,6 +3,14 @@ currentVersion="1.2.0" +checkCurl() +{ + if ! command -v curl &>/dev/null ; then + echo "Error: this tool requires 'curl', please install it." + return 1 + fi +} + checkInternet() { echo -e "GET http://google.com HTTP/1.0\n\n" | nc google.com 80 > /dev/null 2>&1 # query google with a get request @@ -116,6 +124,7 @@ usage() echo " -v Get the tool version" } +checkCurl || exit 1 checkInternet || exit 1 # check if we have a valid internet connection if this isnt true the rest of the script will not work so stop here diff --git a/weather/weather b/weather/weather index ba4e513..19c668c 100755 --- a/weather/weather +++ b/weather/weather @@ -4,6 +4,15 @@ currentVersion="1.2.0" #This version variable should not have a v but should contain all other characters ex Github release tag is v1.2.4 currentVersion is 1.2.4 locale=$(echo $LANG | cut -c1-2) + +checkCurl() +{ + if ! command -v curl &>/dev/null ; then + echo "Error: this tool requires 'curl', please install it." + return 1 + fi +} + getIPWeather() { country=$(curl -s ipinfo.io/country) > /dev/null ## grab the country @@ -87,7 +96,7 @@ usage() echo " -v Get the tool version" } - +checkCurl || exit 1 checkInternet || exit 1 # check if we have a valid internet connection if this isnt true the rest of the script will not work so stop here