Skip to content
RED SAG Skills
hardStudy question · answer published in Linux interview questions, so no pointslinuxbasherror-handling

Failure hidden inside a function

Inside a function, curl fails, but $? is 0 and set -e does not stop the script. Why?

fetch() {
  local body=$(curl -fsS "$URL")
  echo "status: $?"
}
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions