-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 27-03-2005 00:34, Steve Langasek wrote: > On Sun, Mar 27, 2005 at 12:30:19AM +0100, Jonas Smedegaard wrote: > >>On 27-03-2005 00:13, Steve Langasek wrote: >> >>>On Sat, Mar 26, 2005 at 11:43:07PM +0100, Jonas Smedegaard wrote: > > >>>>To keep the code compact I'd just append this to the grep lines: > > >>>> || true if [ $? \< 2 ] > > >>>>Do you see a problem with that? >>> >>>It's not POSIX sh syntax? > > >>" true if " is actually a waste. The following is POSIXly correct, I beieve: > > >> || [ $? \< 2 ] > > >>or must it instead be this: > > >> || test $? \< 2 > > > Either [ or test is fine in POSIX sh, as they're required aliases. > > However, I don't think \< is a POSIX test operator -- I think you want -lt > instead.
Ah, thanks. So many errors lurking in such little code snippet :-) >>Where to find good info on POSIX sh syntax? > > > AIUI the POSIX spec is available for download online, but I don't remember > where. Hmm - with "good" I thought more of "easy to digest" than "official". Haven't checked but I imagine the spec is similar to RFCs (which is not easy to digest IMHO). > Otherwise, you could just test your scripts under dash as well as bash. I know. But info on POSIXly correct coding style is not the same as throwing code at a (hopefully 100%) POSIXly correct shell and see if it complains. - Jonas - -- * Jonas Smedegaard - idealist og Internet-arkitekt * Tlf.: +45 40843136 Website: http://dr.jones.dk/ - Enden er nær: http://www.shibumi.org/eoti.htm -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCRfeMn7DbMsAkQLgRArbHAJwJ8XJT462A/1n8jwoRb4DRe2NpuQCfRM4e a0CSV+Z+LWp+hUflGzZEw2s= =OyIC -----END PGP SIGNATURE-----