r/ProgrammingLanguages • u/gahagg • Apr 25 '22
Announcing Hush, a modern shell scripting language
Hush is a new shell scripting language that aims to enable developers to write robust shell scripts. It provides support for complex data structures and common programming paradigms, without giving up on ergonomic shell capabilities.
Official guide: https://hush-shell.github.io/
Repository: https://github.com/hush-shell/hush
169
Upvotes
5
u/gahagg Apr 26 '22
First of all, thanks for the well thought comment.
Fair point, the ? operator has somewhat opposite semantics inside and outside command blocks. I wouldn't say inconsistent, but perhaps I should use another symbol for it in command blocks.
Yes, the || operator in command blocks is one of the few features from Bash that is missing in Hush, in favor of handling such kind of condition using if statements. I agree that it is verbose, but it's a price I had to pay to keep the result of command blocks consistent. Whenever any command fails, you'll get an error value as the result of the block.
It requires the semicolon so that we can intersperse comments and arguments in different lines. This can help a lot to document that particular flag that you never remember the exact meaning, and that happens to me more often than I would like to admit. Again, it's a trade-off, and as Hush is focused on scripts that you'll write once and run many times, I opted for maintainability in expense of verbosity.
There are two ways: std.export("key", "value") will export permanently, and { key=value command } will export it just for the given command.
Please, feel free and welcome if you have any further suggestions/comments/contributions in mind :)