#ScriptSaturday with enough alias magic, bash can have real try-catch syntax!
libsh module here; BSD-3 :)
#ScriptSaturday with enough alias magic, bash can have real try-catch syntax!
libsh module here; BSD-3 :)
@domi oh, ok.
hmm... wouldn't it make more sense to set the trap inside the subshell?
@domi does that mean one can now
try (
try (
return 1
) catch (
echo catch 1
) yrt
) catch (
echo catch 2
) yrt
?
@wolf480pl jesus christ
wrong braces, but. maybe? i’m gonna check
@wolf480pl okay, nesting is broken. i tried restructuring more stuff into the subshell and it “works” but some catches get redefined as the generic one
i’ll work on it more tomorrow :)
@wolf480pl the horrifying part is that this provides enough utility that I may want to use it! and this only started as a “what if?” :D
nerdsnipes are appreciated. i don’t have anyone else do code review, so this is nice