Closed reklis closed 9 years ago
:+1: This would also open up the possibility of a REPL, which is always nice.
#!/bin/bash
bish $1 | bash
Why don't you write a program that accepts the filename of .bish
as the last argument, redirects the stdout
to an output file and finally executes bish
to compile .bish
?
Accepting a filename as the last argument makes the program possible to be "called" from shebang, and the name of the file, where the shebang is, is the last argument.
Upd: yeah, it's my fault, s/to an output file/to bash
.
being able to #!/usr/bin/env bish
would be nice
I do like this idea. It shouldn't be too difficult to write a bish to bash pipeline usable from the shebang. Something like ExeTwezz's idea, only instead of redirecting to an actual output file, connect bish stdout to bash stdin. With large programs, however, this might result in noticeable delay as the parser and code generator would be run before every execution.
Thanks to @noahmorrison for implementing this.
Perhaps there is some way to have a single step compile / source so that we could make .bish files executable and put a shabang at the top?
Something like :
!/usr/bin/env bish
...
And then that automatically does this when you run it:
bish < myscript.bish | bash
Or something to that effect?
Having to compile it seems like a lot of friction for quick and dirty. But it is great for deploying when you want to drop something on a server and not have to install anything (namely bish)