On 8/20/07, <b class="gmail_sendername">Jeffrey C. Ollie</b> <<a href="mailto:jeff@ocjtech.us">jeff@ocjtech.us</a>> 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> </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'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 'HOME', and the current working directory.<br># Note the single-quotes, not double-quotes or back-tics.
<br>export PS1='[$?]-HOME->$PWD<br>$ ';<br><br><br>Clearly, you'll have up to 1/2 of your screen taken up with data you didn'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>