From ff114660dbc4f229b077db9a41199b861408b4d3 Mon Sep 17 00:00:00 2001 From: Clay Reimann Date: Fri, 23 Jun 2017 09:12:46 -0500 Subject: [PATCH] Guard against unset COLUMNS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When logging in to a new CentOS 7 machine COLUMNS has not been set before the theme is evaluated, causing the following error: ```shell irongiant-mbp → ssh clayreimann@toren.ddns Last login: Fri Jun 23 10:05:11 2017 from cpe-24-209-155-17.wi.res.rr.com -bash: /1: syntax error: operand expected (error token is "/1") -bash-4.2$ ``` This fix is based on advice from https://stackoverflow.com/a/3601734 --- themes/iterate/iterate.theme.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/iterate/iterate.theme.bash b/themes/iterate/iterate.theme.bash index 2031b7fc..cf682a9f 100644 --- a/themes/iterate/iterate.theme.bash +++ b/themes/iterate/iterate.theme.bash @@ -52,7 +52,7 @@ function prompt_command() { fi local wrap_char="" - [[ ${#new_PS1} -gt $(($COLUMNS/1)) ]] && wrap_char="\n" + [[ $COLUMNS && ${#new_PS1} > $(($COLUMNS/1)) ]] && wrap_char="\n" PS1="${new_PS1}${green}${wrap_char}→${reset_color} " }