2016-01-04 20:55:14 +01:00
|
|
|
# bash
|
|
|
|
|
2021-05-20 16:13:41 -04:00
|
|
|
> Bourne-Again SHell, an `sh`-compatible command-line interpreter.
|
2022-08-19 10:53:37 +10:00
|
|
|
> See also: `zsh`, `histexpand` (history expansion).
|
2021-04-14 10:07:21 -04:00
|
|
|
> More information: <https://gnu.org/software/bash/>.
|
2016-01-04 20:55:14 +01:00
|
|
|
|
2021-04-14 10:07:21 -04:00
|
|
|
- Start an interactive shell session:
|
2016-01-04 20:55:14 +01:00
|
|
|
|
|
|
|
`bash`
|
|
|
|
|
2022-08-19 10:53:37 +10:00
|
|
|
- Start an interactive shell session without loading startup configs:
|
2016-01-04 20:55:14 +01:00
|
|
|
|
2022-08-19 10:53:37 +10:00
|
|
|
`bash --norc`
|
2016-01-04 20:55:14 +01:00
|
|
|
|
2022-08-19 10:53:37 +10:00
|
|
|
- Execute specific [c]ommands:
|
|
|
|
|
|
|
|
`bash -c "{{echo 'bash is executed'}}"`
|
|
|
|
|
|
|
|
- Execute a specific script:
|
2016-01-04 20:55:14 +01:00
|
|
|
|
2021-04-14 10:07:21 -04:00
|
|
|
`bash {{path/to/script.sh}}`
|
2016-01-04 20:55:14 +01:00
|
|
|
|
2022-08-19 10:53:37 +10:00
|
|
|
- Execute a specific script while printing each command before executing it:
|
2017-09-21 08:35:20 +01:00
|
|
|
|
2021-04-14 10:07:21 -04:00
|
|
|
`bash -x {{path/to/script.sh}}`
|
2017-09-21 08:35:20 +01:00
|
|
|
|
2022-08-19 10:53:37 +10:00
|
|
|
- Execute a specific script and stop at the first [e]rror:
|
2019-01-23 07:27:08 +01:00
|
|
|
|
2021-04-14 10:07:21 -04:00
|
|
|
`bash -e {{path/to/script.sh}}`
|
2019-01-23 07:27:08 +01:00
|
|
|
|
2022-12-04 08:53:34 +01:00
|
|
|
- Execute specific commands from `stdin`:
|
2016-09-01 14:31:38 +01:00
|
|
|
|
2022-08-19 10:53:37 +10:00
|
|
|
`{{echo "echo 'bash is executed'"}} | bash`
|
2023-06-08 17:04:40 +02:00
|
|
|
|
|
|
|
- Start a [r]estricted shell session:
|
|
|
|
|
|
|
|
`bash -r`
|