From: Iain Patterson Date: Thu, 3 May 2012 14:08:55 +0000 (+0100) Subject: Use bash builtin to check for tty. X-Git-Url: http://git.iain.cx/?a=commitdiff_plain;h=10c940961d293df41967a09e5a8c326beaa94afd;p=profile.git Use bash builtin to check for tty. --- diff --git a/.profile.d/krb5.bashrc b/.profile.d/krb5.bashrc index 034dadd..4c5f71d 100644 --- a/.profile.d/krb5.bashrc +++ b/.profile.d/krb5.bashrc @@ -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. diff --git a/.profile.d/ssh.bashrc b/.profile.d/ssh.bashrc index 0bb5011..65d117d 100644 --- a/.profile.d/ssh.bashrc +++ b/.profile.d/ssh.bashrc @@ -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