Toot

Written by moho on 2024-06-24 at 19:47

TIL about shellscripts: the following failes due to set -e, but not how you might expect:

[#]!/bin/sh -e
foo() {
 false && echo no
}
foo
exit 0

exits with status 1.

Why? Becaus it breaks due to -e on "false"? Not quite - when adding any other successfull command in the line after false all is good. But the exitcode from false seems to propagates as the code from "foo()", leading to abort after exiting foo (before exiting with "exit 0").

=> More informations about this toot | View the thread | More toots from moho1@social.troll.academy

Mentions

Tags

Proxy Information
Original URL
gemini://mastogem.picasoft.net/toot/112673322141753622
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
246.00447 milliseconds
Gemini-to-HTML Time
0.330878 milliseconds

This content has been proxied by September (ba2dc).