Keep track of Terminal access
indent your code!
don't do this

printf "%${padding}s\n" "$1"


do this

printf "%*s\n" "$padding" "$1"

in this section:

cat $loginfofile &gt;&gt; ~/.bash_profile
test $? -eq 0 &amp;&amp; (echo "[OK] Successfully appended '$loginfofile' to '~/.bash_profile'")
test $? -ne 0 &amp;&amp; (echo "[ER] Something went wrong appending '$loginfofile' to '~/.bash_profile'")


the 2 test command is testing the exit status of the previous command, not the cat command. It's either testing the exit status of the previous test command or the first echo command. Either way, you get the result you want, but really by luck. You want

if cat $loginfofile &gt;&gt; ~/.bash_profile; then
    echo "[OK] Successfully appended '$loginfofile' to '~/.bash_profile'"
else
    echo "[ER] Something went wrong appending '$loginfofile' to '~/.bash_profile'"
fi


Be aware that the logic of A &amp;&amp; B || C is different from if A; then B; else C; fi in one subtle way: what happens when B exits non-zero?


in if A; then B; else C; fi when A succeeds but B fails, C will NOT be executed.
in A &amp;&amp; B || C when A succeeds but B fails, C WILL be executed -- the || operator detects the previous command in the pipeline (B) exits non-zero and will execute its right-hand side command.

I'd recommend using select instead of a while loop to get your answer

PS3="Would you like to install 'loginfo'? "
select ans in Yes No; do
    case $ans in
        Yes) install_loginfo
            break
            ;;
        No) echo "'loginfo' was not installed."
            break
            ;;
    esac
done