tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

sh weirdness?

I've been trying to use some external software across various of my
NetBSD machines, and have run into a problem that I've tracked down to
a difference in sh behaviour.  Fortunately, a small test case exists.

Running this

sh -n -c 'case foo in (bar | baz) echo one; esac'

on 4.0.1 returns nothing, but on 1.4T, it gives

Syntax error: word unexpected (expecting ")")

Can anyone explain what this syntax (with the leading open paren and no
closing ;;) does?  The 4.0.1 sh manpage is no help; it lists only the
no-( with-;; syntax, even though the sh it supposedly describes accepts
this mutant version.  Based on the context in which I found it, it
looks as though the case above is probably semantically equivalent to
"case foo in bar|baz) echo one;; esac", but I hesitate to just replace
it without actually understanding what the code I'm replacing does.

/~\ The ASCII                             Mouse
\ / Ribbon Campaign
 X  Against HTML      
/ \ Email!           7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B

Home | Main Index | Thread Index | Old Index