projects
asked on
curl as a variable breaks the script
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?
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?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the help, all fixed now.