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

https://github.com/koalaman/shellcheck/wiki/SC2236
This commit is contained in:
Peter Dave Hello
2018-12-03 13:59:19 +08:00
committed by Jordan Harband
parent 153506c8da
commit 14179bc8ce
2 changed files with 5 additions and 5 deletions

View File

@@ -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"
@@ -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
@@ -250,7 +250,7 @@ nvm_detect_profile() {
done
fi
if [ ! -z "$DETECTED_PROFILE" ]; then
if [ -n "$DETECTED_PROFILE" ]; then
echo "$DETECTED_PROFILE"
fi
}