On 8/20/07, <b class="gmail_sendername">Jeffrey C. Ollie</b> &lt;<a href="mailto:jeff@ocjtech.us">jeff@ocjtech.us</a>&gt; wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
</blockquote><div>&nbsp;</div>...<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">So when ssh-agent doesn't have your identity cached it still prints a
<br>line of text which messes up the comparison. However, by checking the<br>exit code of 'ssh-add -l' I was able to get it to work:</blockquote><div><br>...<br><br>I&#39;ve got a trick which helps me remember to always use the exit code in my scripts instead of relying on the output of a program. This also helps me keep track of my current working directory and machine name, without pushing my prompt to the right edge of the screen.
<br><br>I recommend to all users who ever script in bash/ksh/sh to use a prompt like the following:<br><br># Prompt with the last exit vale, the word &#39;HOME&#39;, and the current working directory.<br># Note the single-quotes, not double-quotes or back-tics.
<br>export PS1=&#39;[$?]-HOME-&gt;$PWD<br>$ &#39;;<br><br><br>Clearly, you&#39;ll have up to 1/2 of your screen taken up with data you didn&#39;t have before, but you start to really rely on that data in short order. Put whatever data you need out there.
<br><br>Chris<br></div></div>