Skip to content

Commit

Permalink
Use -n/-z instead of ! -z/! -n condition
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterDaveHello committed Dec 3, 2018
1 parent ac30e52 commit d3c15f2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ nvm_has() {
}

nvm_install_dir() {
if [ ! -z "$NVM_DIR" ]; then
if [ -n "$NVM_DIR" ]; then
printf %s "${NVM_DIR}"
elif [ ! -z "$XDG_CONFIG_HOME" ]; then
elif [ -n "$XDG_CONFIG_HOME" ]; then
printf %s "${XDG_CONFIG_HOME/nvm}"
else
printf %s "$HOME/.nvm"
Expand Down Expand Up @@ -123,7 +123,7 @@ install_nvm_from_git() {
fi
fi
command git -c advice.detachedHead=false --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" checkout -f --quiet "$(nvm_latest_version)"
if [ ! -z "$(command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" show-ref refs/heads/master)" ]; then
if [ -n "$(command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" show-ref refs/heads/master)" ]; then
if command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" branch --quiet 2>/dev/null; then
command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" branch --quiet -D master >/dev/null 2>&1
else
Expand Down Expand Up @@ -250,7 +250,7 @@ nvm_detect_profile() {
done
fi

if [ ! -z "$DETECTED_PROFILE" ]; then
if [ -n "$DETECTED_PROFILE" ]; then
echo "$DETECTED_PROFILE"
fi
}
Expand Down
2 changes: 1 addition & 1 deletion nvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ nvm_rc_version() {
return 1
fi
NVM_RC_VERSION="$(command head -n 1 "${NVMRC_PATH}" | command tr -d '\r')" || command printf ''
if [ ! -n "${NVM_RC_VERSION}" ]; then
if [ -z "${NVM_RC_VERSION}" ]; then
nvm_err "Warning: empty .nvmrc file found at \"${NVMRC_PATH}\""
return 2
fi
Expand Down

0 comments on commit d3c15f2

Please sign in to comment.