From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from euclid.skiles.gatech.edu (list@euclid.skiles.gatech.edu [130.207.146.50]) by coral.primenet.com.au (8.7.5/8.7.3) with ESMTP id OAA00970 for ; Mon, 12 Aug 1996 14:47:55 +1000 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id AAA00964; Mon, 12 Aug 1996 00:35:43 -0400 (EDT) Resent-Date: Mon, 12 Aug 1996 00:35:43 -0400 (EDT) From: "Bart Schaefer" Message-Id: <960811213634.ZM4881@candle.brasslantern.com> Date: Sun, 11 Aug 1996 21:36:34 -0700 In-Reply-To: Zoltan Hidvegi "Re: sh compatibility again :->" (Aug 12, 4:18am) References: <199608120218.EAA03734@hzoli.ppp.cs.elte.hu> Reply-To: schaefer@nbn.com X-Mailer: Z-Mail (4.0b.729 29jul96) To: Zoltan Hidvegi , borsenkow.msk@sni.de, zsh-workers@math.gatech.edu Subject: Re: sh compatibility again :-> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <"RLFor3.0._E.UIh3o"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/1941 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu On Aug 12, 4:18am, Zoltan Hidvegi wrote: } Subject: Re: sh compatibility again :-> } } Andrej Borsenkow wrote: } [...] } > 1. It doesn't like malformed constructs like } > } > A="`cat /some/file" (note missed backtick) } > } > zsh tries to parse command substitution behind closing double-quote, and } > ends up with `missing "' at the end of script. Our /bin/sh stops at } > closing double-quote. In POSIX the result is undefined - thus, techically } > neither violate it. } } I copied the behaviour of bash here. pdksh also behaves this way. Right; if I recall correctly, bash and ksh both permit stuff like: $ echo "foo `echo "bar baz"` boing" That is, bash and ksh nest double quotes inside backticks. Old-fashioned Bourne shell, on the other hand, does NOT permit nesting of double quotes, even inside backticks. So in bash/ksh the above is parsed as (echo) (foo `echo "bar baz"` boing) but in sh it is (echo) (foo `echo bar) (baz` boing) The only way to resolve this would be with yet another option, SH_QUOTES or some such. Worth it? Dunno. } > But the following things could probably be fixed } > } > 4. Traditional /bin/sh interprets `set -' as set +xv. } } OK. I've changed that. set - will be the same as set +xv and } set - args will be the same as set +xv -- args. Hmm. So what's the approved way of setting $1 to "-x"? `set -- -x`? And is `set --` equivalent to `shift $#`, since `set -` is not? Are you sure `set - args` should act like `set +xv -- args`? I can't say I'm entirely excited about this change. } > 5. Currently zsh sets BSD_ECHO when running as sh. Our sh does support } > escapes in echo; I recall that SCO sh does it as well. I don't know about } > others. What about relaxing it? If scripts doesn't rely upon escapes in } > echo, it would make no harm. } } I'll try to write a configure check for the echo style of /bin/sh and use } that. Eww, no. Let's pick one behavior and stick with it, please. The default options, even in an emulation mode, shouldn't vary from one installation to the next! It's been a long time since I encountered an sh that didn't have a builtin SysV-style echo -- BSD_ECHO is needed mostly for csh compatibility. I'd vote for leaving BSD_ECHO off when run as "sh". -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.nbn.com/people/lantern New male in /home/schaefer: >N 2 Justin William Schaefer Sat May 11 03:43 53/4040 "Happy Birthday"