Files
tldr/pages.zh/common/bash.md

37 lines
780 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# bash
> Bourne-Again SHell一个与 `sh` 兼容的命令行解释器。
> 另见:`zsh``histexpand`(历史扩展)。
> 更多信息:<https://www.gnu.org/software/bash/>。
- 启动一个交互式 shell 会话:
`bash`
- 启动一个不加载启动配置的交互式 shell 会话:
`bash --norc`
- 执行特定的 [c]ommands
`bash -c "{{echo 'bash is executed'}}"`
- 执行特定脚本:
`bash {{path/to/script.sh}}`
- E[x]ecute 特定脚本,在执行每个命令之前打印该命令:
`bash -x {{path/to/script.sh}}`
- 执行特定脚本并在第一个 [e]rror 处停止:
`bash -e {{path/to/script.sh}}`
-`stdin` 执行特定命令:
`{{echo "echo 'bash is executed'"}} | bash`
- 启动一个 [r]estricted shell 会话:
`bash -r`