I've noticed in some shell scripts these sorts of tests:

if [ x$SSH_AUTH_SOCK != x ]; then

So if $SSH_AUTH_SOCK isn't set, it won't enter the if.

In Bash there are other ways to test a var exists:

[ ${SSH_AUTH_SOCK:+set} ]

or

<span class="createlink"><a href="/ikiwiki.cgi?page=___36__SSH_AUTH_SOCK_&amp;from=e%2F13003&amp;do=create" rel="nofollow">?</a> &#36;SSH AUTH SOCK </span>

Though these account for WHITESPACE they do not work in every shell.

Thanks to twkm on #bash for taking the time to explain this to me.

Feedback

Powered by Vanilla PHP feedback form