Skip to content
Myr

[shellcheck] Use `-n/-z` instead of `! -z/! -n` condition

Before adoption: this commit came in with the history the project adopted, so no landing records it.

https://github.com/koalaman/shellcheck/wiki/SC2236

authored by Peter Dave Hello · committed by Jordan Harband · parent 153506c · Browse files · 2 files+5 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • https: //github.com/koalaman/shellcheck/wiki/SC2236

Diff stats

2 files+5 added−5 removed

  • other:+5 added−5 removed

2 files+5 added−5 removed

modified:install.sh+4 added-4 removed
5 unmodified lines
6 type "$1" > /dev/null 2>&17}89nvm_install_dir() {10 if [ ! -z "$NVM_DIR" ]; then10 if [ -n "$NVM_DIR" ]; then11 printf %s "${NVM_DIR}"12 elif [ ! -z "$XDG_CONFIG_HOME" ]; then12 elif [ -n "$XDG_CONFIG_HOME" ]; then13 printf %s "${XDG_CONFIG_HOME/nvm}"14 else15 printf %s "$HOME/.nvm"16 fi
105 unmodified lines
122 }123 fi124 fi125 command git -c advice.detachedHead=false --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" checkout -f --quiet "$(nvm_latest_version)"126 if [ ! -z "$(command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" show-ref refs/heads/master)" ]; then126 if [ -n "$(command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" show-ref refs/heads/master)" ]; then127 if command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" branch --quiet 2>/dev/null; then128 command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" branch --quiet -D master >/dev/null 2>&1129 else130 echo >&2 "Your version of git is out of date. Please update it!"
118 unmodified lines
249 fi250 done251 fi252253 if [ ! -z "$DETECTED_PROFILE" ]; then253 if [ -n "$DETECTED_PROFILE" ]; then254 echo "$DETECTED_PROFILE"255 fi256}257
157 unmodified lines
modified:nvm.sh+1 added-1 removed
321 unmodified lines
322 nvm_err "No .nvmrc file found"323 return 1324 fi325 NVM_RC_VERSION="$(command head -n 1 "${NVMRC_PATH}" | command tr -d '\r')" || command printf ''326 if [ ! -n "${NVM_RC_VERSION}" ]; then326 if [ -z "${NVM_RC_VERSION}" ]; then327 nvm_err "Warning: empty .nvmrc file found at \"${NVMRC_PATH}\""328 return 2329 fi330 nvm_echo "Found '${NVMRC_PATH}' with version <${NVM_RC_VERSION}>"
3256 unmodified lines