use #!/usr/bin/env bash and fix doc #291
Merged
+6
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ubuntu
❯ sh dev_init.sh
dev_init.sh: 4: Bad substitution
dev_init.sh: 12: Syntax error: redirection unexpected
我研究了下,貌似ubuntu默认sh是dash
https://unix.stackexchange.com/questions/442510/how-to-use-bash-for-sh-in-ubuntu
有多个程序实现了 的语言 /bin/sh 。在 Ubuntu 上, /bin/sh 是 dash,它被设计为快速,使用少量内存,并且不支持超过预期的最低限度 /bin/sh 。在 RHEL 上, /bin/sh 是 bash,它速度较慢,使用更多内存,但具有更多功能。其中一个功能是 [ 条件语法的 == 运算符。Dash 支持 [ ,这是一个基本的 sh 功能,但它没有作为 bash(以及 ksh 和 zsh)扩展的 == 运算符。
Since Ubuntu 22.10 and Debian 12, this is no longer supported; if you want to switch /bin/sh to /bin/bash, you’ll have to symlink it manually. See Gilles’ answer for details.
从 Ubuntu 22.10 和 Debian 12 开始,不再支持此功能;如果要切换 /bin/sh 到 /bin/bash ,则必须手动对其进行符号链接。有关详细信息,请参阅 Gilles 的回答。