tldr/pages/common/bash.md

38 lines
791 B
Markdown
Raw Normal View History

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