zsh-users
 help / color / mirror / code / Atom feed
From: ramos@ih4ess.ih.lucent.com
To: zsh-users@math.gatech.edu
Subject: Re: Perl replacement challenge
Date: Wed, 29 Oct 1997 11:09:44 -0600	[thread overview]
Message-ID: <199710291709.LAA11607@ihnns581.ih.lucent.com> (raw)


> 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



             reply	other threads:[~1997-10-29 17:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-10-29 17:09 ramos [this message]
1997-10-29 20:20 ` TGAPE!
  -- strict thread matches above, loose matches on Subject: below --
1997-10-29 16:19 ramos
1997-10-29 16:46 ` Peter Stephenson
1997-10-29 16:59 ` Bruce Stephens
1997-10-29 17:08 ` Andrew Main
1997-10-29 17:11 ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199710291709.LAA11607@ihnns581.ih.lucent.com \
    --to=ramos@ih4ess.ih.lucent.com \
    --cc=zsh-users@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).