Comment by cosmos0072
5 months ago
It does not sacrifice sub-shell syntax: it is fully supported, I just had to rename it from ( ... ) to [ ... ] to avoid conflicts with ( ... ) that switches to lisp syntax
Also, both $(...) and `...` shell interpolation are fully supported.
The only thing I intentionally sacrificed is shell flow control: schemesh shell syntax does not have the builtins 'case' 'for' 'if' 'while' etc.
In practically all examples I tried, escaping to Scheme for loops and conditional code works better: it avoids the usual pitfalls related to shell string splitting, and usually results in more readable code too, at least for a Lisper
Note: there's also some additional parsing logic to distinguish between sub-shell syntax [ ... ] and wildcard patterns that use [ ... ] as well
Then [ shadows the sh executable aliased from ‘test’ so that you can no longer do
But have to write
That's true.
In shells, "test" and "[" are often used after "if", as for example
Schemesh does not have a shell builtin "if", you switch to Scheme for that:
Thus the need for "test" and its alias "[" is reduced.
Also, "test" implements a mini-language full of one-letter operators: `-f FILE` `COND1 -a COND2` `COND1 -o COND2` etc.
I really don't miss it, as I find the equivalent in Scheme to be more readable - and of course more general
etc.