[kupfer] kupfer-activate.sh: Tweak how we detect open tty



commit 6e7da48f778c25b58db83328e00ddefba1131cad
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Tue Jan 12 17:20:16 2010 +0100

    kupfer-activate.sh: Tweak how we detect open tty

 kupfer-activate.sh |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/kupfer-activate.sh b/kupfer-activate.sh
index b895116..b9016e9 100755
--- a/kupfer-activate.sh
+++ b/kupfer-activate.sh
@@ -26,13 +26,12 @@ test ${PYTHONDIR:0:1} = "@" && PYTHONDIR=$(dirname $0)
 
 # We allow either ``kupfer QUERY`` to pass text on the command line,
 # or reading directly from stdin if we pipe text into Kupfer
-if tty --quiet
+if ! tty --quiet
 then
-	TEXT_INPUT="$*"
-else
 	echo "kupfer: Reading from stdin"
 	TEXT_INPUT=$(cat)
 fi
+test -z "$TEXT_INPUT" && TEXT_INPUT="$*"
 
 # If there are any options, like "--help", we run Kupfer directly
 test "x${1:0:2}" = "x--"



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]