more brains for term check
[feisty_meow.git] / scripts / tty / terminal_titler.sh
index 329ec57c7664fc563dddba10e2f0b2c7754b0fa3..eddfb510ebd686336f74491b212b4b518a3317d8 100644 (file)
@@ -1,6 +1,7 @@
 #!/bin/bash
 
 source "$FEISTY_MEOW_SCRIPTS/core/functions.sh"
+source "$FEISTY_MEOW_SCRIPTS/core/common.alias"
 
 # just saying this is an array...
 #declare -a PRIOR_TERMINAL_TITLES
@@ -72,7 +73,15 @@ function set_terminal_title()
   if [ -z "${title}" ]; then
     title="$(hostname)"
   fi
-  echo -n -e "\033]0;${title}\007"
+  
+  if [ "${TERM}" != "dumb" -a -z "$PBS_ENVIRONMENT" -a ! -z "$PS1" ]; then
+    echo -n -e "\033]0;${title}\007"
+  else
+    # not running interactively, so just echo the title.
+    sep
+    echo ${title}
+    sep
+  fi
 }
 
 # reads the current terminal title, if possible, and saves it to our stack of titles.