From 5d5c1b449edaa0f3ffaa79368325427c24d847bc Mon Sep 17 00:00:00 2001 From: Ryan L McIntyre Date: Sun, 11 Aug 2019 00:13:55 -0700 Subject: [PATCH] Fixes double negative expressions ShellCheck rule SC2236 --- install.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/install.sh b/install.sh index d4f06b1ce..5948791ca 100755 --- a/install.sh +++ b/install.sh @@ -138,10 +138,10 @@ nerdfonts_root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/patched-fonts" nerdfonts_dirs=("$nerdfonts_root_dir") # Accept font / directory names, to avoid installing all fonts -if [ ! -z "$*" ]; then +if [ -n "$*" ]; then nerdfonts_dirs=() for font in "${@}"; do - if [ ! -z "$font" ]; then + if [ -n "$font" ]; then # Ensure that directory exists, and offer suggestions if not if [[ ! -d "$nerdfonts_root_dir/$font" ]]; then echo -e "Font $font doesn't exist. Options are: \\n" @@ -169,17 +169,17 @@ find_exclude= # If we have patches or compat, define what to include include=() -if [ ! -z "${patches[*]}" ]; then +if [ -n "${patches[*]}" ]; then include=( "${include[@]}" "${patches[@]}" ) fi -if [ ! -z "${compat[*]}" ]; then +if [ -n "${compat[*]}" ]; then include=( "${include[@]}" "${compat[@]}" ) fi # Delete empty elements for i in "${!include[@]}"; do [ "${include[$i]}" = '' ] && unset include["$i"] done -if [ ! -z "${include[*]}" ]; then +if [ -n "${include[*]}" ]; then implode find_include "*' -and -name '*" "${include[@]}" find_include="-and -name '*${find_include}*'" fi @@ -193,7 +193,7 @@ done for i in "${!exclude[@]}"; do [ "${exclude[$i]}" = '' ] && unset exclude["$i"] done -if [ ! -z "${exclude[*]}" ]; then +if [ -n "${exclude[*]}" ]; then implode find_exclude "*' -and \\! -name '*" "${exclude[@]}" find_exclude="-and \\! -name '*${find_exclude}*'" fi