tldr/pages/common/rbash.md

31 lines
758 B
Markdown
Raw Normal View History

2017-11-16 21:40:05 +00:00
# rbash
> Restricted Bash shell, equivalent to `bash --restricted`.
> Does not permit changing the working directory, redirecting command output, or modifying environment variables, among other things.
> See also `histexpand` for history expansion.
> More information: <https://www.gnu.org/software/bash/manual/html_node/The-Restricted-Shell>.
2017-11-16 21:40:05 +00:00
- Start an interactive shell session:
2017-11-16 21:40:05 +00:00
`rbash`
- Execute a command and then exit:
2017-11-16 21:40:05 +00:00
`rbash -c "{{command}}"`
- Execute a script:
2017-11-16 21:40:05 +00:00
`rbash {{path/to/script.sh}}`
2017-11-16 21:40:05 +00:00
- Execute a script, printing each command before executing it:
2017-11-16 21:40:05 +00:00
`rbash -x {{path/to/script.sh}}`
- Execute commands from a script, stopping at the first error:
`rbash -e {{path/to/script.sh}}`
- Read and execute commands from `stdin`:
`rbash -s`