summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Weingärtner <timo@tiwe.de>2013-06-20 16:00:08 +0200
committerTimo Weingärtner <timo@tiwe.de>2013-06-20 16:00:08 +0200
commit3db5e4a6aa2e85492638438dac5719ce633ad6f5 (patch)
tree81c03ceacdf3607768b2d8e263fcde216153dcea
parente9f27a1f6c79fddabd5995a591a8398ca645c53f (diff)
downloadssh-agent-filter-3db5e4a6aa2e85492638438dac5719ce633ad6f5.tar.gz
add detection for output to terminal vs. pipe
-rwxr-xr-xafssh9
1 files changed, 6 insertions, 3 deletions
diff --git a/afssh b/afssh
index 2a4d570..3b9d84f 100755
--- a/afssh
+++ b/afssh
@@ -86,8 +86,11 @@ unset SSH_AGENT_PID
trap 'kill "$SSH_AGENT_PID"; rm -r "$TEMPDIR"' EXIT
TEMPDIR=$(mktemp -d)
-eval $(cd "$TEMPDIR"; "$SAF" "${agent_filter_args[@]}" || echo exit $?)
-
-ssh-add -l
+if [ -t 1 ]; then
+ eval $(cd "$TEMPDIR"; "$SAF" "${agent_filter_args[@]}" || echo exit $?)
+ ssh-add -l
+else
+ eval $(cd "$TEMPDIR"; "$SAF" "${agent_filter_args[@]}" || echo exit $?) > /dev/null
+fi
ssh -A "$@"