diff --git a/.shellcheckrc b/.shellcheckrc index 6def9b8..7d307e9 100644 --- a/.shellcheckrc +++ b/.shellcheckrc @@ -5,6 +5,14 @@ # https://github.com/koalaman/shellcheck/wiki/Ignore ############################################################################### +# Disable SC2183 +# +# Running into this: https://github.com/koalaman/shellcheck/issues/1310 +# TODO: Check if resolved. +# +#https://github.com/koalaman/shellcheck/wiki/SC2183 +disable=SC2183 + # Disable SC2206 and SC2207 # # `IFS` and `noglob` are set. diff --git a/hosts b/hosts index 9be3b81..cd74d76 100755 --- a/hosts +++ b/hosts @@ -344,7 +344,7 @@ _print_entries() { fi done <<< "${_input}" - _max_divided="$((_max_length / 8))" + local _max_quotient="$((_max_length / 8))" while IFS=$'\t ' read -r -a _parts do @@ -354,9 +354,9 @@ _print_entries() { printf "disabled:\\n" fi - _current_divided=$((${#_parts[0]} / 8)) - _tab_count=$((_max_divided - _current_divided + 1)) - # shellcheck disable=SC2183 + local _current_quotient=$((${#_parts[0]} / 8)) + local _tab_count=$((_max_quotient - _current_quotient + 1)) + local _tabs= _tabs="$(printf "%*s" ${_tab_count} | tr " " '\t')" if [[ -n "${_parts[2]:-}" ]]