/bin/stty is in Debian&Alpine, /usr/bin/stty is in Cygwin.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Wed, 02 Jan 2019 23:49:07 +0200
changeset 919 cdf599c86ccf
parent 918 0cba37c54a9e
child 920 c03d7e5281ac
/bin/stty is in Debian&Alpine, /usr/bin/stty is in Cygwin.
.bashrc
--- a/.bashrc	Tue Jan 01 23:38:59 2019 +0200
+++ b/.bashrc	Wed Jan 02 23:49:07 2019 +0200
@@ -16,8 +16,12 @@
   local ruler='================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================'
   if [[ -x /usr/bin/tput ]]; then
     local size=`/usr/bin/tput cols`
+  elif [[ -x /bin/stty ]]; then
+    local size=`/bin/stty size | { read x y; echo $y; }`
+  elif [[ -x /usr/bin/stty ]]; then
+    local size=`/usr/bin/stty size | { read x y; echo $y; }`
   else
-    local size=`/usr/bin/stty size | { read x y; echo $y; }`
+    local size=80
   fi
   ruler=${ruler:0:${size}}
   _my_ruler=$ruler