do not emit term codes if not term
authorChris Koeritz <fred@gruntose.com>
Tue, 7 Feb 2017 13:16:43 +0000 (08:16 -0500)
committerChris Koeritz <fred@gruntose.com>
Tue, 7 Feb 2017 13:16:43 +0000 (08:16 -0500)
scripts/tty/terminal_titler.sh

index 329ec57c7664fc563dddba10e2f0b2c7754b0fa3..f4a18282bac6fd7e2212c4726044e60f2bb4ba82 100644 (file)
@@ -72,7 +72,15 @@ function set_terminal_title()
   if [ -z "${title}" ]; then
     title="$(hostname)"
   fi
-  echo -n -e "\033]0;${title}\007"
+  
+  if [ -z "$PS1" ]; then
+    # not running interactively, so just echo the title.
+    sep
+    echo ${title}
+    sep
+  else
+    echo -n -e "\033]0;${title}\007"
+  fi
 }
 
 # reads the current terminal title, if possible, and saves it to our stack of titles.