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} ]


<span class="createlink"><a href="/ikiwiki.cgi?do=create&amp;from=e%2F13003&amp;page=___36__SSH_AUTH_SOCK_" 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.


Powered by Vanilla PHP feedback form