代码拉取完成,页面将自动刷新
bash
built-ins.
${HOSTNAME:-$(hostname)}
shellcheck
to properly lint it.Use sh
for functions that should be linted and unit tested.
```sh
# Shellcheck will lint this and the test script will source this.
func() {
# Usage: func "arg"
:
}
```
Use shell
for code that should be ignored.
```shell
# Shorter file creation syntax.
:>file
```
The test file is viewable here: https://github.com/dylanaraps/pure-bash-bible/blob/master/test.sh
Example test:
test_upper() {
result="$(upper "HeLlO")"
assert_equals "$result" "HELLO"
}
Steps:
test_func_name
$result
or ${result[@]}
).assert_equals
to test equality between the variable and the
expected output.Running test.sh
also runs shellcheck
on the code.
cd pure-bash-bible
./test.sh
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。