From b43e35abedab2b3680501280039b71ce56dc7b8d Mon Sep 17 00:00:00 2001 From: habere-et-dispertire Date: Sat, 19 Mar 2022 11:14:22 +0000 Subject: [PATCH] Dogfooding the examples spots SC2250, SC2292 --- SC2312.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/SC2312.md b/SC2312.md index 6a2d421..56c11b9 100644 --- a/SC2312.md +++ b/SC2312.md @@ -7,7 +7,7 @@ This is an optional suggestion enabled with `shellcheck -o check-extra-masked-re ```sh set -e cd "$(get_chroot_dir)/etc" -tar xf "$config" +tar xf "${config}" ``` ### Correct code: @@ -15,8 +15,8 @@ tar xf "$config" ```sh set -e dir="$(get_chroot_dir)" -cd "$dir/etc" -tar xf "$config" +cd "${dir}/etc" +tar xf "${config}" ``` ### Correct code: (with correction) @@ -24,9 +24,9 @@ tar xf "$config" ```sh set -e dir="$(get_chroot_dir)" -[ -d "${dir}" ] || exit 1 -cd "$dir/etc" -tar xf "$config" +[[ -d "${dir}" ]] || exit 1 +cd "${dir}/etc" +tar xf "${config}" ``` ### Rationale: