I am trying to Loop through all the arguments, then I want it to be url encoded. It works currently but not with things like single quotes. Ex. What's the weather outside?
This is what I have tried:
for var in "$@"
do
n+="$var "
done
h="${n%?}"
export h
urlencode() { python -c "import os, sys, urllib as ul; print ul.quote_plus(os.environ['h'])"; }
e=$(urlencode "$h")
t=$(curl -s --request GET "http://example.com/?q=$e")
echo $t