Fixing the $@ by double quoting to prevent word splitting
This commit is contained in:
parent
eb7b5c2001
commit
82219534c4
|
@ -47,7 +47,7 @@ checkInternet()
|
||||||
getMovieInfo()
|
getMovieInfo()
|
||||||
{
|
{
|
||||||
apiKey=946f500a # try not to abuse this it is a key that came from the ruby-scripts repo I link to.
|
apiKey=946f500a # try not to abuse this it is a key that came from the ruby-scripts repo I link to.
|
||||||
movie=$(echo $@ | tr " " + ) ## format the inputs to use for the api
|
movie=$(echo "$@" | tr " " + ) ## format the inputs to use for the api
|
||||||
export PYTHONIOENCODING=utf8 #necessary for python2 in some cases
|
export PYTHONIOENCODING=utf8 #necessary for python2 in some cases
|
||||||
movieInfo=$(httpGet "http://www.omdbapi.com/?t=$movie&apikey=$apiKey") > /dev/null # query the server and get the JSON response
|
movieInfo=$(httpGet "http://www.omdbapi.com/?t=$movie&apikey=$apiKey") > /dev/null # query the server and get the JSON response
|
||||||
checkResponse=$(echo $movieInfo | python2 -c "import sys, json; print json.load(sys.stdin)['Response']")
|
checkResponse=$(echo $movieInfo | python2 -c "import sys, json; print json.load(sys.stdin)['Response']")
|
||||||
|
@ -167,6 +167,6 @@ elif [[ $1 == "update" ]];then
|
||||||
elif [[ $1 == "help" ]];then
|
elif [[ $1 == "help" ]];then
|
||||||
usage
|
usage
|
||||||
else
|
else
|
||||||
getMovieInfo $@ || exit 1 ## exit if we return 1 (chances are movie was not found)
|
getMovieInfo "$@" || exit 1 ## exit if we return 1 (chances are movie was not found)
|
||||||
printMovieInfo ## print out the data
|
printMovieInfo ## print out the data
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -183,7 +183,7 @@ elif [[ $# == "0" ]];then
|
||||||
usage
|
usage
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
getTicker $@ # the company name might have spaces so passing in all args allows for this
|
getTicker "$@" # the company name might have spaces so passing in all args allows for this
|
||||||
getStockInformation $symbol # based on the stock symbol exrapolated by the getTicker function get information on the stock
|
getStockInformation $symbol # based on the stock symbol exrapolated by the getTicker function get information on the stock
|
||||||
printStockInformation # print this information out to the user in a human readable format
|
printStockInformation # print this information out to the user in a human readable format
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -238,14 +238,14 @@ elif [[ $1 == "help" ]];then
|
||||||
else
|
else
|
||||||
if [[ $search == "0" ]];then
|
if [[ $search == "0" ]];then
|
||||||
if [[ $info == "0" ]];then
|
if [[ $info == "0" ]];then
|
||||||
getSimilar $@ || exit 1 ## exit if we return 1 (chances are movie was not found)
|
getSimilar "$@" || exit 1 ## exit if we return 1 (chances are movie was not found)
|
||||||
printResults
|
printResults
|
||||||
else
|
else
|
||||||
getSimilar $@ || exit 1
|
getSimilar "$@" || exit 1
|
||||||
printResults
|
printResults
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
getInfo ${@:2} || exit 1 ## exit if we return 1 (chances are movie was not found)
|
getInfo "${@:2}" || exit 1 ## exit if we return 1 (chances are movie was not found)
|
||||||
printInfo
|
printInfo
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -49,7 +49,7 @@ getIPWeather()
|
||||||
|
|
||||||
getLocationWeather()
|
getLocationWeather()
|
||||||
{
|
{
|
||||||
args=$(echo $@ | tr " " + )
|
args=$(echo "$@" | tr " " + )
|
||||||
httpGet $locale.wttr.in/${args}
|
httpGet $locale.wttr.in/${args}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,5 +159,5 @@ elif [[ $1 == "m" ]]; then
|
||||||
elif [[ $1 == "i" ]]; then
|
elif [[ $1 == "i" ]]; then
|
||||||
getIPWeather "?u"
|
getIPWeather "?u"
|
||||||
else
|
else
|
||||||
getLocationWeather $@
|
getLocationWeather "$@"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue