do not emit term codes if not term
[feisty_meow.git] / scripts / tty / terminal_titler.sh
index e4262498080b5f89d688d2efbd15c2fa00985e65..f4a18282bac6fd7e2212c4726044e60f2bb4ba82 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-source $FEISTY_MEOW_SCRIPTS/core/functions.sh
+source "$FEISTY_MEOW_SCRIPTS/core/functions.sh"
 
 # just saying this is an array...
 #declare -a PRIOR_TERMINAL_TITLES
@@ -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.