Comment made by: pesterhazy
Re: alterantives, the Bash code needs to be able to read the .main
file and split the contents into individual arguments. Ideally this should be done with Bash builtins only, i.e. without spwaning another process.
Parsing JSON, or EDN, is not possible with pure Bash. Another possibility would be to separate arguments by newline. But the Bash code to read that back into an array would not be trivial, or at least less trivial than using eval
to parse the contents.
Using the eval builtin has the potential downside that, like the Clojure reader, the Bash reader can have side effects. For example, when the contents contain $(rm /important/file)
or >/important/file
.
However, we control the code that writes the file and escape all characters. So the dollar and larger-than characters would be prefixed with a backslash. I think that's safe.
I'll have to think about backward/forward compatibility - good point.