Command line
The bushelscript command-line tool runs BushelScript scripts. To use it, you'll probably want to install it to a location visible to your command-line shell (i.e., in your PATH). You can do this in BushelScript Editor → Preferences → Interpreter. The default install path is /usr/local/bin/bushelscript. Please note that if you want to permanently move BushelScript Editor, you'll have to reinstall the tool. (Temporary moves and updates, as well as remounting drives, cause no problems. It's a symbolic link, if you're familiar with those.)
Run scripts#
There are three ways to run scripts with the bushelscript command-line tool.
From a file#
If you don't specify -e or --interactive mode, then the first argument to bushelscript will be treated as the name of a script file to run.
The special file name - means standard input.
From command line arguments#
If you specify one or more -e, then the argument after -e is treated as a line of BushelScript code. The -e lines are stitched into a script and then run.
An alternative to this approach is to use a heredoc or similar, if your shell supports it:
Interactive (REPL) mode#
To get an interactive shell where you can run BushelScript code with immediate feedback, specify --interactive or -i.
Language#
To specify the language on the command line, use --language or -l followed by a language ID. If the script's #! (hashbang) line contains this -l flag, the language ID it specifies is used, and the language given at the command line (if any) is ignored. If neither of these sources dictate which language to use, the default is bushelscript_en (BushelScript English).
Output#
Result#
By default, the tool will print the result of the final executed expression to standard output. To suppress this, specify --no-result or -R.
Printing/logging#
To print things to standard output, use the log command in your script. For now, there's no built-in way to write to other streams (or read text input).
Input#
Arguments#
All non-option, non-script file arguments passed to bushelscript will be available via the built-in arguments property.
Environment variables#
To read environment variables, get an environment variable (aka env var) by name and inspect its value property.
You can also set environment variables through this property.