Introduction
With Hush installed, we’re able to execute scripts. Here’s the traditional Hello world program in Hush:
The first line is a ). It tells the operating system which interpreter to use for the script. The second line is a function call of the function from the standard library. When executed, this script will output Hello world!
to the standard output.
You can also execute a given script calling Hush with the script path as argument. When executing a script using this method, the Shebang is unnecessary, and will be disregarded as an ordinary comment.
Alternatively, when given no aguments, Hush will start a non-interactive shell. You can go ahead and write your Hush script into the terminal. When you’re done, press Ctrl-D and Hush will execute everything you’ve typed. Ctrl-D sends a special End of File (EOF) signal to the Hush interpreter so that it knows where the script ends.
Consider the following , which attempts to use the undeclared variable value
:
We can check verify that the script has semantic errors: