2016-01-04 19:55:14 +00:00
|
|
|
# bash
|
|
|
|
|
2021-05-20 21:13:41 +01:00
|
|
|
> Bourne-Again SHell, an `sh`-compatible command-line interpreter.
|
2021-04-04 21:07:13 +01:00
|
|
|
> See also `histexpand` for history expansion.
|
2021-04-14 15:07:21 +01:00
|
|
|
> More information: <https://gnu.org/software/bash/>.
|
2016-01-04 19:55:14 +00:00
|
|
|
|
2021-04-14 15:07:21 +01:00
|
|
|
- Start an interactive shell session:
|
2016-01-04 19:55:14 +00:00
|
|
|
|
|
|
|
`bash`
|
|
|
|
|
2021-04-14 15:07:21 +01:00
|
|
|
- Execute a command and then exit:
|
2016-01-04 19:55:14 +00:00
|
|
|
|
2016-09-04 20:59:10 +01:00
|
|
|
`bash -c "{{command}}"`
|
2016-01-04 19:55:14 +00:00
|
|
|
|
2021-04-14 15:07:21 +01:00
|
|
|
- Execute a script:
|
2016-01-04 19:55:14 +00:00
|
|
|
|
2021-04-14 15:07:21 +01:00
|
|
|
`bash {{path/to/script.sh}}`
|
2016-01-04 19:55:14 +00:00
|
|
|
|
2021-04-14 15:07:21 +01:00
|
|
|
- Execute a script, printing each command before executing it:
|
2017-09-21 08:35:20 +01:00
|
|
|
|
2021-04-14 15:07:21 +01:00
|
|
|
`bash -x {{path/to/script.sh}}`
|
2017-09-21 08:35:20 +01:00
|
|
|
|
2021-04-14 15:07:21 +01:00
|
|
|
- Execute commands from a script, stopping at the first error:
|
2019-01-23 06:27:08 +00:00
|
|
|
|
2021-04-14 15:07:21 +01:00
|
|
|
`bash -e {{path/to/script.sh}}`
|
2019-01-23 06:27:08 +00:00
|
|
|
|
2021-04-14 15:07:21 +01:00
|
|
|
- Read and execute commands from stdin:
|
2016-01-04 19:55:14 +00:00
|
|
|
|
2016-02-23 01:14:41 +00:00
|
|
|
`bash -s`
|
2016-09-01 14:31:38 +01:00
|
|
|
|
2021-04-14 15:07:21 +01:00
|
|
|
- Print the Bash version (`$BASH_VERSION` contains the version without license information):
|
2016-09-01 14:31:38 +01:00
|
|
|
|
|
|
|
`bash --version`
|