TERM is missing when run non-interactively through SSH. Disable ruler in non-interacticve session.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Thu, 03 Jun 2021 02:02:50 +0300
changeset 987 e0ffdc132f41
parent 986 080abbbb7ba7
child 988 b5c31b623dec
TERM is missing when run non-interactively through SSH. Disable ruler in non-interacticve session.
.bashrc
--- a/.bashrc	Wed Jun 02 21:46:48 2021 +0300
+++ b/.bashrc	Thu Jun 03 02:02:50 2021 +0300
@@ -23,8 +23,12 @@
   ruler=${ruler:0:${size}}
   _my_ruler=$ruler
 }
-_my_ruler_handler
-trap '_my_ruler_handler' SIGWINCH
+case $- in
+  *i*)
+    _my_ruler_handler
+    trap '_my_ruler_handler' SIGWINCH
+    ;;
+esac
 
 PS1='\n${_my_ruler}\r$?|\u@\h \w \nbash# '
 PS2='> '