mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Dogfooding the examples spots SC2250, SC2292
12
SC2312.md
12
SC2312.md
@@ -7,7 +7,7 @@ This is an optional suggestion enabled with `shellcheck -o check-extra-masked-re
|
|||||||
```sh
|
```sh
|
||||||
set -e
|
set -e
|
||||||
cd "$(get_chroot_dir)/etc"
|
cd "$(get_chroot_dir)/etc"
|
||||||
tar xf "$config"
|
tar xf "${config}"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Correct code:
|
### Correct code:
|
||||||
@@ -15,8 +15,8 @@ tar xf "$config"
|
|||||||
```sh
|
```sh
|
||||||
set -e
|
set -e
|
||||||
dir="$(get_chroot_dir)"
|
dir="$(get_chroot_dir)"
|
||||||
cd "$dir/etc"
|
cd "${dir}/etc"
|
||||||
tar xf "$config"
|
tar xf "${config}"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Correct code: (with correction)
|
### Correct code: (with correction)
|
||||||
@@ -24,9 +24,9 @@ tar xf "$config"
|
|||||||
```sh
|
```sh
|
||||||
set -e
|
set -e
|
||||||
dir="$(get_chroot_dir)"
|
dir="$(get_chroot_dir)"
|
||||||
[ -d "${dir}" ] || exit 1
|
[[ -d "${dir}" ]] || exit 1
|
||||||
cd "$dir/etc"
|
cd "${dir}/etc"
|
||||||
tar xf "$config"
|
tar xf "${config}"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Rationale:
|
### Rationale:
|
||||||
|
Reference in New Issue
Block a user