Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 May 2012 12:50:26 -0600 (MDT)
From:      Warren Block <wblock@wonkity.com>
To:        Guido Falsi <madpilot@freebsd.org>
Cc:        freebsd-doc@freebsd.org, FreeBSD-gnats-submit@freebsd.org
Subject:   Re: docs/167932: [PATCH] examples/csh/dot.cshrc SSH_AUTH_SOCK example incorrect
Message-ID:  <alpine.BSF.2.00.1205151135110.45754@wonkity.com>
In-Reply-To: <3VsPD05sWNz2Yb@megatron.madpilot.net>
References:  <3VsPD05sWNz2Yb@megatron.madpilot.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 15 May 2012, Guido Falsi wrote:

> It is my personal opinion that sample code should be as correctly
> working as possible.
>
> The simpliest and most legible (used in the attached patch):
>
> setenv SSH_AUTH_SOCK `sockstat | grep "${USER}" | grep ssh-agent | awk '{ print $6 }'`

awk can do a little more to eliminate the second grep:

setenv SSH_AUTH_SOCK `sockstat | grep "^${USER} " | awk '/ssh-agent/ { print $6 }'`

The anchor before and space after the username in the grep are to make 
it an exact match and not a subset ("jsm" versus "jsmith").  Although I 
don't know what sockstat does with a username longer than eight 
characters.

> I know this is a minor glitch, but I thought it was worth reporting
> anyway.

It is.  Accuracy and precision are the goal.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.2.00.1205151135110.45754>