Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Perl replacement challenge



ramos@xxxxxxxxxxxxxxxxxxxx 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 lists exported variables directly from ksh, which quotes them
where necessary; also it unexports _ and PWD (this does not reach back
to the calling zsh of course) so they don't appear in the list.  Since
ksh doesn't put the `export' in front, you can use `allexport'; that
only lasts for the length of the function.

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.

-- 
Peter Stephenson <pws@xxxxxx>       Tel: +49 33762 77366
WWW:  http://www.ifh.de/~pws/       Fax: +49 33762 77413
Deutsches Elektronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, Platanenallee 6, 15738 Zeuthen, Germany.



Messages sorted by: Reverse Date, Date, Thread, Author