Dogfooding the examples spots SC2250, SC2292

habere-et-dispertire
2022-03-19 11:14:22 +00:00
parent afbbee7882
commit b43e35abed

@@ -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: