docs/167932: [PATCH] examples/csh/dot.cshrc SSH_AUTH_SOCK example incorrect

Warren Block wblock at wonkity.com
Tue May 15 18:50:33 UTC 2012


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.



More information about the freebsd-doc mailing list