Shells and interpreters
Weave expressions#
A weave expression embeds a foreign script within a BushelScript program. When a weave is evaluated, its body is evaluated by the shell or other interpreter specified in its hashbang (#!
) line.
Another #!
on its own line ends the weave body. If it declares an interpreter, it also begins a new weave.
This example uses two weave expressions, one using Bash and another using Python.
#
Weave outputWeave expressions evaluate to whatever is written to their standard output. In the above example, the Bash script writes Hello, world!
to its stdout, causing the bash
weave to evaluate to the string
value "Hello, world!"
.
#
Weave inputSimilarly, weaves are automatically provided, through standard input, the current value of that
coerced to a string
. In the above example, the Python script reads the result of the bash
weave from its own stdin and echoes it back out.