From 7f65362be605ac52e0f9cdad9d15ac910933228d Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Tue, 26 Apr 2016 23:04:51 +0200
Subject: [PATCH] Fix for 'tput: No value for $TERM and no -T specified' on
 ssh.

---
 dotfiles/minimal/shinit | 57 ++++++++++++++++++++++-------------------
 1 file changed, 31 insertions(+), 26 deletions(-)

diff --git a/dotfiles/minimal/shinit b/dotfiles/minimal/shinit
index c80a6bc..25d1396 100644
--- a/dotfiles/minimal/shinit
+++ b/dotfiles/minimal/shinit
@@ -1,32 +1,37 @@
 # Settings for interactive shells.
 
-# Fancy colors for ls.
-alias ls="ls --color=auto"
+# Ensure shell truly is interactive to avoid confusing non-interactive shells.
+if [[ $- == *i* ]]; then
 
-# Use vim as default editor for anything.
-export VISUAL=vim
-export EDITOR=$VISUAL
+    # Fancy colors for ls.
+    alias ls="ls --color=auto"
 
-# Colored prompt with username, hostname, date/time, directory.
-colornumber=7 # Default to white if no color set via colornumber dotfile.
-colornumber_file=~/.shinit_color
-if [ -f $colornumber_file ]; then
-    colornumber=`cat $colornumber_file` 
-fi
-tput_color="$(tput setaf $colornumber)$(tput bold)"
-tput_reset="$(tput sgr0)"
-# Bash confuses the line length when not told to not count escape sequences.
-if [ ! "$BASH" = "" ]; then
-    tput_color="\[$tput_color\]"
-    tput_reset="\[$tput_reset\]"
-fi
-PS1="${tput_color}["\$\(date\ +%Y-%m-%d/%H:%M:%S/%Z\)" $USER@$(hostname):"\$\(pwd\)"]$ $tput_reset"
-PS2="${tput_color}> $tput_reset"
-PS3="${tput_color}select: $tput_reset"
-PS4="${tput_color}+ $tput_reset"
+    # Use vim as default editor for anything.
+    export VISUAL=vim
+    export EDITOR=$VISUAL
+
+    # Colored prompt with username, hostname, date/time, directory.
+    colornumber=7 # Default to white if no color set via colornumber dotfile.
+    colornumber_file=~/.shinit_color
+    if [ -f $colornumber_file ]; then
+        colornumber=`cat $colornumber_file`
+    fi
+    tput_color="$(tput setaf $colornumber)$(tput bold)"
+    tput_reset="$(tput sgr0)"
+    # Bash confuses the line length when not told to not count escape sequences.
+    if [ ! "$BASH" = "" ]; then
+        tput_color="\[$tput_color\]"
+        tput_reset="\[$tput_reset\]"
+    fi
+    PS1="${tput_color}["\$\(date\ +%Y-%m-%d/%H:%M:%S/%Z\)" $USER@$(hostname):"\$\(pwd\)"]$ $tput_reset"
+    PS2="${tput_color}> $tput_reset"
+    PS3="${tput_color}select: $tput_reset"
+    PS4="${tput_color}+ $tput_reset"
+
+    # Add local additions.
+    local_shinit_file=~/.shinit_add
+    if [ -f $local_shinit_file ]; then
+        . $local_shinit_file
+    fi
 
-# Add local additions.
-local_shinit_file=~/.shinit_add
-if [ -f $local_shinit_file ]; then 
-    . $local_shinit_file 
 fi
-- 
2.30.2