Tag Info

New answers tagged

0

You might be able to use curl's --fail option, though you should test it once first. man curl -f, --fail (HTTP) Fail silently (no output at all) on server errors. This is mostly done to better enable scripts etc to better deal with failed attempts. In normal cases when an HTTP server fails to ...


3

The simplest way is to store the response and compare it: $ response=$(curl -X POST -d@myfile.txt server-URL); $ if [ "Upload successful" == "${response}" ]; then … fi; I haven't tested that. The syntax might be off, but that's the idea. I'm sure there are more sophisticated ways of doing it such as checking curl's exit code or something. update curl ...


0

code=$desired_HTML_return_code url="https://launchpad.net/ubuntu/+ppas?name_filter=Pipelight" _curl=$( curl -o /dev/stderr -sL -w \ "%{http_code} %{url_effective}\\n" "$url" ) [ ${_curl%%[!0-9]*} -eq $code ] && {\ ppa="${_curl##*~}" ppa="ppa:${ppa%%/*}/${_curl##*namefilter=}" } So I haven't tested the above, but apparently this guy ...


2

This should do what you want: curl https://launchpad.net/ubuntu/+ppas?name_filter=Pipelight | awk -F/ '/>Pipelight</{print $2}' Explanation: The -F/ sets the filed delimiter to /, and the />Pipelight</ means "run the commands in the {} only on lines matching >Pipelight<. So, at least in the example you posted, the line with ...


0

I think you are trying to find out the sites which have 301 status code returned. You can actually write the contents of the curl command to a file and do a grep on Location to find out the URLs for the status code 301. Try this one. curl -s --head -w %{http_code} https://launchpad.net/~[a-z]/+archive/pipelight -o grep 'Location' file1.txt The output ...



Top 50 recent answers are included