Don't rely on tty.
authorIain Patterson <me@iain.cx>
Mon, 5 Aug 2013 14:02:31 +0000 (15:02 +0100)
committerIain Patterson <me@iain.cx>
Fri, 4 Oct 2013 11:08:28 +0000 (12:08 +0100)
The tty command may not always be available.  Use the builtin test -t 0.

.bash_profile
.bashrc

index a89f59e..6fe0759 100644 (file)
@@ -1,4 +1,4 @@
-if tty -s || [ "${0:0:1}" = "-" -o "$1" = "force" ]; then
+if [ -t 0 -o "${0:0:1}" = "-" -o "$1" = "force" ]; then
   # Remember if nocaseglob was on.
   shopt -q nocaseglob
   nocg=$?
diff --git a/.bashrc b/.bashrc
index 3d80825..5f4fdb5 100644 (file)
--- a/.bashrc
+++ b/.bashrc
@@ -1,4 +1,4 @@
-if tty -s; then
+if [ -t 0 ]; then
   . /etc/profile
   . ~/.bash_profile
 fi