On Sat, Sep 04, 2021 at 11:23:48PM -0500, David Wright wrote: > $ cat /var/local/lib/myhosts/colours/axis > 5 magenta bbarbutton=white,magenta,none:bbarhotkey=magenta,white,none > $ > > 5 is for ANSI colours, > magenta is for, eg emacs, mutt, etc, > bbarbutton is for mc. > > The lines from /root/.bashrc are: > > if [[ $- = *i* ]]; then > > export PROMPT_COMMAND='Myprompt="$? " && [ "$Myprompt" = "0 " ] && > Myprompt=""' > > # read value from file, and sanitise it > Hue=$(head -c 1 /var/local/lib/myhosts/colours/"$HOSTNAME") > if grep -q ·"$Hue"· <<<"·0·1·2·3·4·5·6·7·8·9·"; then
It's strange that you used shell builtins for the $- check but not for this check. read -r Hue _ < /var/local/lib/myhosts/colours/"$HOSTNAME" if [[ $Hue = [0-9] ]]; then Or if you happen to use the other fields of that file later in the script, then change the read command to store all 3 fields in shell variables.