From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7052 invoked from network); 29 Oct 1997 16:26:56 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 29 Oct 1997 16:26:56 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id LAA02513; Wed, 29 Oct 1997 11:19:44 -0500 (EST) Resent-Date: Wed, 29 Oct 1997 11:19:23 -0500 (EST) From: ramos@ih4ess.ih.lucent.com Date: Wed, 29 Oct 1997 10:19:56 -0600 Message-Id: <199710291619.KAA11548@ihnns581.ih.lucent.com> To: zsh-users@math.gatech.edu Subject: Perl replacement challenge X-Sun-Charset: US-ASCII Resent-Message-ID: <"znlb_.0.Zc.A8sLq"@math> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/1114 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu hello, I work in an environment surrounded by KSH users (hey does this qualify as a "hostile work environment"??). That includes the system administrators and tool developers, so it is not surprising there are many scripts in the system which must be "dotted" into ksh to do something non-trivial and dynamically setup environment variables as a result. 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: #!/usr/local/bin/perl # Fixup the output from 'env' so it can be sourced by zsh foreach $ev (keys %ENV) { next if $ev eq "_" || $ev eq "PWD"; print "export $ev="; $val = $ENV{$ev}; $val =~ s/'/'"'"'/g; print "'$val'\n"; } Obviously, I'm not happy with having to invoke Perl everytime I need to source a system script. But since it works, I've left it as is for several months. I would appreciate hearing suggestions on how to get rid of Perl, or other ideas you have for dealing with the root problem (Note: I don't like to use "emulate -R ksh" in my interactive shells, it disables too many nice zsh features).