tldr/pages/common/bash.md

34 lines
666 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 `histexpand` for history expansion.
2019-06-09 00:05:27 +01:00
> More information: <https://gnu.org/software/bash>.
2016-01-04 19:55:14 +00:00
2016-02-23 01:14:41 +00:00
- Start interactive shell:
2016-01-04 19:55:14 +00:00
`bash`
2016-02-23 01:14:41 +00:00
- Execute a command:
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
2016-02-23 01:14:41 +00:00
- Run commands from a file:
2016-01-04 19:55:14 +00:00
2016-02-23 01:14:41 +00:00
`bash {{file.sh}}`
2016-01-04 19:55:14 +00:00
2017-09-21 08:35:20 +01:00
- Run commands from a file, logging all commands executed to the terminal:
`bash -x {{file.sh}}`
2019-01-23 06:27:08 +00:00
- Run commands from a file, stopping at the first error:
`bash -e {{file.sh}}`
- Run 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
- Print the version information of bash (use `echo $BASH_VERSION` to show just the version without license information):
2016-09-01 14:31:38 +01:00
`bash --version`