0
url="http://localhost:8080/matlib"
until $(curl "$url" --max-time 10) == 0; do stuck_pid=$(chown_pid); kill -9 $stuck_pid && "killing chmod process";done

what I'm trying to do is curl this address, if it times out after 10 seconds, then term a PID.

The part that is failing is the '== 0', the intention here was to compare the return code from curl with 0, but I'm receiving the following error:

-bash: ==: command not found

1 Answer 1

1

This indeed is the problem:

$(curl "$url" --max-time 10) == 0

== operator must be inside [[ ... ]] or [ ... ] square brackets.

However you are not comparing exit status of curl but output of curl since you are executing $(...) or command substitution.

You should be using just:

until curl "$url" --max-time 10; do ...; done
Sign up to request clarification or add additional context in comments.

1 Comment

0 means success in shell and when you execute until curl "$url" --max-time 10; do ...; done it only checks for exit code 0.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.