From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7265 invoked from network); 29 Oct 1997 17:14:28 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 29 Oct 1997 17:14:28 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id MAA04305; Wed, 29 Oct 1997 12:09:36 -0500 (EST) Resent-Date: Wed, 29 Oct 1997 12:09:08 -0500 (EST) From: ramos@ih4ess.ih.lucent.com Date: Wed, 29 Oct 1997 11:09:44 -0600 Message-Id: <199710291709.LAA11607@ihnns581.ih.lucent.com> To: zsh-users@math.gatech.edu Subject: Re: Perl replacement challenge X-Sun-Charset: US-ASCII Resent-Message-ID: <"NKTRx3.0.g11.pssLq"@math> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/1118 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu > From pws@hydra.ifh.de Wed Oct 29 10:47:20 1997 > X-Perlmail-1: 0 junkmail pattern matches > Subject: Re: Perl replacement challenge > To: ramos@ih4ess.ih.lucent.com, zsh-users@math.gatech.edu (Zsh users list) > > ramos@ih4ess.ih.lucent.com wrote: > > I have a very simple and effective solution: > > > > # Use "kshdot some_ksh_script" instead of ". some_ksh_script" > > > > kshdot() { source =(ksh -c ". $* 1>&2; senv") } > > > > Where 'senv' is the following Perl script: > > ... > > As a minimal modification which omits the Perl script, how about > > kshdot() { > setopt allexport localoptions > source =(ksh -c ". $* 1>&2; typeset +x _ PWD; typeset -x") > } > This almost works! But the 'typeset -x' runs inside ksh (which, in fact, it has to), which means the quoting syntax is different. e.g. If a variable contains control characters, ksh would print: FOO=$'\n\n\a\n' And that's not parsed correctly by zsh, even with "emulate ksh" on. That example, by the way, works fine with my Perl solution. Any other ideas??? I was wanting to rewrite the Perl script as a zsh function, but I can't find a "search and replace" builtin in zsh to do the quoting. e.g. senv() { .... this is hard to write ... } kshdot() { source =(ksh -c ". $* 1>&2" | senv) } > > But remember you can make emulate local to a function. You might get > away with something like > > kshdot() { emulate ksh; setopt localoptions; . $*; } > > at least for some of the scripts. Yup, works for some scripts. But some of them go out of their way to try to make sure you're really running an honest ksh. Thanks for your time, -- Alex Ramos atramos@lucent.com