curl as a variable breaks the script
Posted on 2014-07-19
The following variable was being used in a bash script;
CURL="curl -o /dev/null -u "$USERNAME:$PASSWD" --connect-timeout 5 -X POST"
Then, in my script, I would use the following;
$CURL -F function=clean_reports $SERVER_URL/myapp.php
I found that curl wasn't sending anything to php until I removed the variable and turned each curl line into the following;
curl -o /dev/null -u "$USERNAME:$PASSWD" --connect-timeout 5 -X POST -F function=clean_reports $SERVER_URL/myapp.php
Why? And how can I use this variable to shorten my lines?