script¶
script is a built-in function. It runs a script file, with
optional arguments.
| Parameter | Required | Default | Meaning |
|---|---|---|---|
path |
yes | — | Path to the script |
args |
no | empty | Arguments passed after the path |
Run a script with arguments
This runs /usr/local/bin/report.sh --today. If you leave args out, it runs
just /usr/local/bin/report.sh.
The script must be executable¶
The path is run directly, so the file needs the execute bit:
If you cannot change the file, run it through an interpreter instead. The
echo-script example in the release
pack does exactly that by calling bash first.
Related¶
command— run an inline command instead of a file- Echo Script — run a script through Bash
- Built-in functions — both built-in functions
- Shell — how commands are executed