Today I found that the order of curl parameters really makes a difference when you want to print error messages with set "show-error" and "silent" options.
Example:
user@server:~/> curl --silent --show-error -k "http://wweeee.com"
curl: (6) Couldn't resolve host 'wweeee.com'
user@server:~/> curl --show-error --silent -k "http://wweeee.com"
user@server:~/>
Another interesting observation - I have a script which does curl requests and captures the output. When I want to get error messages, I have to redirect error to stderr file first like this:
curl --silent --show-error -k "http://blablabla" 2>$OUTFILE.error | sed -e "...." >> $OUTFILE
If I change the order to have error redirect at the end of command, it does not work (the error output is printed to console, but not to the file I requested):
curl --silent --show-error -k "http://blablabla" | sed -e "...." >> $OUTFILE
2>$OUTFILE.error
No comments:
Post a Comment