4 ms·
> The difference is the syntax is structured more like Java's `try` and `catch` blocks Which is a big plus, but the most interesting part to me is the "if" beh
by linkdd 6y ago
> The difference is the syntax is structured more like Java's `try` and `catch` blocks
Which is a big plus, but the most interesting part to me is the "if" behavior you implemented.
!if { foobar } then { ... }
Which basically translate to Bash (without STDOUT/STDERR handling):
foobar
if [ $? -ne 0 ] then ... fi
This is like 99% of my use cases when I'm writing scripts...
> As for testing, [...] they explain the syntax but not how nor why you might want to use it.
When I saw the examples, I immediately thought of "validation scripts" that would assert that an environment respects some specification (like the configure script from autotools ?)
> but man this post is already lengthy hehe
I enjoyed the details :)
- hhvn 6y agoThis works the same as your example in bash. foobar || { echo fail; }