Skip to content

Commit c246e4a

Browse files
Address some shellcheck issues
1 parent 1919404 commit c246e4a

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/shellcheck/install.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ set -e
55
SHELLCHECK_VERSION="${VERSION:-"os-provided"}"
66
INSTALL_PATH="${INSTALLPATH:-"/usr/local/bin"}"
77

8-
if [ "$(id -u)" -ne 0 ]; then
8+
if [[ "$(id -u)" -ne 0 ]]; then
99
printf 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.'
1010
exit 1
1111
fi
1212

1313

14-
if [ "${SHELLCHECK_VERSION}" = "os-provided" ]; then
14+
if [[ "${SHELLCHECK_VERSION}" = "os-provided" ]]; then
1515
apt update --yes
1616
apt install --no-install-recommends --yes shellcheck
1717

@@ -27,8 +27,8 @@ if ! type curl >/dev/null 2>&1; then
2727
curl_installed="true"
2828
fi
2929

30-
if [ "${SHELLCHECK_VERSION}" = "latest" ]; then
31-
SHELLCHECK_VERSION=$(curl -s --head https://github.com/koalaman/shellcheck/releases/latest | sed -nr 's/location:.*\/v(.+)/\1/ip' | tr -d '\r')
30+
if [[ "${SHELLCHECK_VERSION}" = "latest" ]]; then
31+
SHELLCHECK_VERSION="$(curl -s --head https://github.com/koalaman/shellcheck/releases/latest | sed -nr 's/location:.*\/v(.+)/\1/ip' | tr -d '\r')"
3232
fi
3333

3434
machine="$(uname -m)"
@@ -47,6 +47,6 @@ url="https://github.com/koalaman/shellcheck/releases/download/v${SHELLCHECK_VERS
4747

4848
curl -sSL "${url}" | tar --strip-components=1 -Jxvf - -C "${INSTALL_PATH}" "shellcheck-v${SHELLCHECK_VERSION}/shellcheck"
4949

50-
if [ -n "${curl_installed}" ]; then
50+
if [[ -n "${curl_installed}" ]]; then
5151
apt purge curl --autoremove --yes
5252
fi

0 commit comments

Comments
 (0)