1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 23:24:55 +02:00
tldr/pages.zh/common/bash.md

38 lines
786 B
Markdown
Raw Permalink Normal View History

2019-08-14 21:41:34 +08:00
# bash
> Bourne-Again SHell,兼容 `sh` 的命令行解释器。
> 此外请参阅:`zsh`,`histexpand`(历史展开)。
> 更多信息:<https://www.gnu.org/software/bash/>.
2019-08-14 21:41:34 +08:00
2022-03-27 07:25:15 +02:00
- 启动交互式 shell:
2019-08-14 21:41:34 +08:00
`bash`
- 启动一个不加载启动配置的交互式的 shell 会话:
`bash --norc`
- 执行命令:
2019-08-14 21:41:34 +08:00
`bash -c "{{echo '已执行bash命令'}}"`
2019-08-14 21:41:34 +08:00
- 执行脚本文件:
2019-08-14 21:41:34 +08:00
`bash {{路径/到/脚本文件.sh}}`
2019-08-14 21:41:34 +08:00
- 执行脚本文件,并将所有执行过的命令输出到终端:
2019-08-14 21:41:34 +08:00
`bash -x {{路径/到/脚本文件.sh}}`
2019-08-14 21:41:34 +08:00
- 执行脚本文件,并在第一个错误处终止:
2019-08-14 21:41:34 +08:00
`bash -e {{路径/到/脚本文件.sh}}`
-`stdin` 执行指定的命令:
`{{echo "echo '已执行bash命令'"}} | bash`
- 启动一个限制的 shell 会话:
`bash -r`