ken@rochester.ARPA (Comfy chair) (06/17/86)
References: I hit an incompatability between the 4.2 BSD sh and Sun 3.0 sh. Here are the relevant parts of the manual pages: From 4.2 BSD system: ${parameter-word} If parameter is set, substitute its value; otherwise substitute word. ${parameter=word} If parameter is not set, set it to word; the value of the parameter is then substituted. Positional parame- ters may not be assigned to in this way. ${parameter?word} If parameter is set, substitute its value; otherwise, print word and exit from the shell. If word is omit- ted, a standard message is printed. ${parameter+word} If parameter is set, substitute word; otherwise substi- tute nothing. From Sun 3.0 system: ${parameter:-word} If parameter is set and is non-null, substitute its value; otherwise substitute word. ${parameter:=word} If parameter is not set or is null set it to word; the value of the parameter is substituted. Positional parameters may not be assigned to in this way. ${parameter:?word} If parameter is set and is non-null, substitute its value; otherwise, print word and exit from the shell. If word is omitted, the message ``parameter null or not set'' is printed. ${parameter:+word} If parameter is set and is non-null, substitute word; otherwise substitute nothing. In case you missed it, the difference is the extra colon in the Sun 3.0 system. Questions: when and why was this change made? Are there any other variants of Unix with this change? Has anybody's command file broken on account of this? Ken -- UUCP: ..!{allegra,decvax,seismo}!rochester!ken ARPA: ken@rochester.arpa Snail: CS Dept., U. of Roch., NY 14627. Voice: Ken!
ark@alice.UucP (Andrew Koenig) (06/18/86)
> In case you missed it, the difference is the extra colon in the Sun 3.0 > system. Questions: when and why was this change made? Are there any > other variants of Unix with this change? Has anybody's command file > broken on account of this? In case you missed it, the other difference is "if parameter is set" vs. "if parameter is set and non-null." I believe that the Sys V shell supports both usages. The point is that a parameter that is not set is not necessarily the same as one that is set to null.
dpb@iwtpu.UUCP (Darryl Baker) (06/18/86)
In article <18951@rochester.ARPA> ken@rochester.UUCP (Comfy chair) writes: >I hit an incompatability between the 4.2 BSD sh and Sun 3.0 sh. Here >are the relevant parts of the manual pages: Text deleted >In case you missed it, the difference is the extra colon in the Sun 3.0 >system. Questions: when and why was this change made? Are there any >other variants of Unix with this change? Has anybody's command file >broken on account of this? > Ken If you havn't noticed the Sun 3.0 shell is the System V.2 shell with an echo(1) format compatible with BSD. -- ________________________________________________________________________________ From the sleepy terminal of Darryl Baker ihnp4!laidbak!dpb
guy@sun.uucp (Guy Harris) (06/18/86)
> I hit an incompatability between the 4.2 BSD sh and Sun 3.0 sh. No, you didn't. Keep reading. > Here are the relevant parts of the manual pages: > > From 4.2 BSD system: > > ${parameter-word} > If parameter is set, substitute its value; otherwise > substitute word. > ... > > From Sun 3.0 system: > > ${parameter:-word} > If parameter is set and is non-null, substitute its > value; otherwise substitute word. > In case you missed it, the difference is the extra colon in the Sun 3.0 > system. And the phrase "and is non-null", which appears in the description in the Sun 3.0 manual. Like I said, keep reading. In the 3.0 manual, below that, it says: If the colon (:) is omitted from the above expressions, the shell only checks whether "parameter" is set. So it's a compatible enhancement; you can leave the colon out, and if you do it acts like earlier shells. > Questions: when and why was this change made? It was made in Sun UNIX 3.0, and was made because the System V Release 2 shell, which is the Sun UNIX 3.0 shell, is better than the 4.2BSD shell (faster, more functional, less buggy, you name it). > Are there any other variants of Unix with this change? Any variant using a System III or later shell. > Has anybody's command file broken on account of this? Since it's a compatible enhancement, I tend to doubt it. -- Guy Harris {ihnp4, decvax, seismo, decwrl, ...}!sun!guy guy@sun.com (or guy@sun.arpa)
shannon@sun.UUCP (06/19/86)
> > I hit an incompatability between the 4.2 BSD sh and Sun 3.0 sh. Here > are the relevant parts of the manual pages: > > ... > > In case you missed it, the difference is the extra colon in the Sun 3.0 > system. Questions: when and why was this change made? Are there any > other variants of Unix with this change? Has anybody's command file > broken on account of this? > > Ken > -- > UUCP: ..!{allegra,decvax,seismo}!rochester!ken ARPA: ken@rochester.arpa > Snail: CS Dept., U. of Roch., NY 14627. Voice: Ken! A few lines down on the same Sun 3.0 man page: "If the colon (:) is omitted from the above expressions, the shell only checks whether parameter is set or not." I believe there is no incompatibility. The Sun 3.0 sh is based on the System V sh, unlike the 4.xBSD sh, which is based on the V7 sh. The System V sh has fixed a number of bugs and is overall much more reliable. Bill Shannon
jdb@mordor.ARPA (John Bruner) (06/19/86)
I am delighted that Sun 3.0 uses the System V shell. (Shell functions on my Sun at last!) However, it is not completely compatible with the previous shell. For instance, the Berkeley-added "limit" command is not implemented. The interpretation of "<<-", while very useful, may also break some old command files. I've run into problems with large shell variables in "sh" on Sun 3.0; however, I can't pin down the exact difficulty. [It is really bizarre. It runs fine on our 4.3BSD VAXes and Sun 2's but fails sometimes in 3.0. The old Sun 2 shell works in Sun 2.0 and fails in Sun 3.0 in the same way. The 4.3BSD shell, compiled on the Sun 3's, fails in the same way. There seems to be some dependence upon the directory in which a small set of the commands is run -- sometimes I can make it run by finding the "right" directory -- but there is no discernable pattern to this.] -- John Bruner (S-1 Project, Lawrence Livermore National Laboratory) MILNET: jdb@mordor [jdb@s1-c.ARPA] (415) 422-0758 UUCP: ...!ucbvax!decwrl!mordor!jdb ...!seismo!mordor!jdb
dml@rabbit1.UUCP (David Langdon) (06/20/86)
> > ${parameter:-word} ... > ${parameter:=word} ... > ${parameter:?word} ... > ${parameter:+word} ... > > In case you missed it, the difference is the extra colon in the Sun 3.0 > system. Questions: when and why was this change made? Are there any > other variants of Unix with this change? Has anybody's command file > broken on account of this? > > Ken Don't know the real answer to this, but from what ksh (korn shell) documentation I have seen, the Sun 3.0 sh uses the same syntax as the korn shell (which is supposed to be sh compatible). -- ----------------------------------------------------------- David Langdon Rabbit Software Corp. ...!ihnp4!{cbmvax,cuuxb}!hutch!dml ...!psuvax1!burdvax!hutch!dml (215) 647-0440 7 Great Valley Parkway East Malvern PA 19355
guy@sun.UUCP (06/21/86)
> I am delighted that Sun 3.0 uses the System V shell. (Shell functions > on my Sun at last!) However, it is not completely compatible with the > previous shell. For instance, the Berkeley-added "limit" command is > not implemented. "limit" command? I just tried typing "limit" at a Sun 2.3 machine's Bourne shell, and it said "limit: not found". I looked in the source to it, and to the 4.2BSD and 4.3betaBSD Bourne shell source, and didn't see any "limit" command. Is it a late addition to 4.3BSD? -- Guy Harris {ihnp4, decvax, seismo, decwrl, ...}!sun!guy guy@sun.com (or guy@sun.arpa)
jdb@mordor.ARPA (John Bruner) (06/23/86)
>> I am delighted that Sun 3.0 uses the System V shell. (Shell functions >> on my Sun at last!) However, it is not completely compatible with the >> previous shell. For instance, the Berkeley-added "limit" command is >> not implemented. > >"limit" command? I just tried typing "limit" at a Sun 2.3 machine's Bourne >shell, and it said "limit: not found". I looked in the source to it, and to >the 4.2BSD and 4.3betaBSD Bourne shell source, and didn't see any "limit" >command. Is it a late addition to 4.3BSD? Oops. No, although I haven't seen the released 4.3BSD source yet, I don't think "limit" was ever added to "sh" at Berkeley. The "sh" I used on my VAX until recently wasn't vanilla BSD. I was not careful enough when I verified the "limit" command on the VAX here. I could have sworn that I verified this feature was in the vanilla Sun 2 shell before I posted my followup. I am embarrassed to admit that I was a source of misinformation. -- John Bruner (S-1 Project, Lawrence Livermore National Laboratory) MILNET: jdb@mordor [jdb@s1-c.ARPA] (415) 422-0758 UUCP: ...!ucbvax!decwrl!mordor!jdb ...!seismo!mordor!jdb