Use bash builtin to check for tty.
authorIain Patterson <me@iain.cx>
Thu, 3 May 2012 14:08:55 +0000 (15:08 +0100)
committerIain Patterson <me@iain.cx>
Thu, 14 Jun 2012 10:33:01 +0000 (11:33 +0100)
.profile.d/krb5.bashrc
.profile.d/ssh.bashrc

index 034dadd..4c5f71d 100644 (file)
@@ -3,7 +3,7 @@ alias pssh='ssh -o preferredauthentications=password,keyboard-interactive'
 
 unalias kinit 2>/dev/null
 if [ 1 = 0 -a -z "$OLDSOLARIS" -a -z "$OLDREDHAT" ]; then
-  if tty -s; then
+  if [ -t 0 ]; then
     if [ ! "$SUDO_UID" ]; then
       if klist -s 2>/dev/null; then
         # We already have a ticket cache.  Renew it.
index 0bb5011..65d117d 100644 (file)
@@ -6,7 +6,7 @@ if [ $UID -gt 0 ]; then
       while read allowed; do
         if [ "${HOSTNAME%%.*}" = "$allowed" ]; then
           eval $(keychain -q --timeout 7200 --agents ssh --eval)
-          if tty -s; then
+          if [ -t 0 ]; then
             ssh-add -l >/dev/null || ssh-add
           fi
         fi