From: "Andrej Borsenkow" <borsenkow.msk@sni.de>
To: "Peter Stephenson" <pws@ibmth.df.unipi.it>,
<zsh-workers@math.gatech.edu>
Subject: RE: PATCH: 3.1.5: eval with exported vars
Date: Fri, 11 Dec 1998 16:27:50 +0300 [thread overview]
Message-ID: <001b01be250a$0cd92290$21c9ca95@mowp.siemens.ru> (raw)
In-Reply-To: <9812111245.AA42577@ibmth.df.unipi.it>
>
> "Andrej Borsenkow" wrote:
> > But as I understand, your patch blindly exports variable for
> every builtin?
>
> No, just eval, which is a peculiar case because you really don't know
> what it's going to do.
Sorry. But I don't think this is needed. Currently it behaves exactly as it
should.
bor@itsrm2:~smbsrc/source%> FOO=x eval sh -c 'echo $FOO'
bor@itsrm2:~smbsrc/source%> FOO=x eval 'sh -c echo $FOO'
Both are correct as you explained. The string after -c is just "echo" It is
funny, but so is it.
bor@itsrm2:~smbsrc/source%> FOO=x eval sh -c "echo $FOO"
Correct. $FOO is expanded when the whole is first read.
bor@itsrm2:~smbsrc/source%> FOO=x eval 'sh -c "echo $FOO"'
x
Correct. eval gets 'sh -c "$FOO"', expands $FOO to x, so it amounts to sh -c
'echo x'.
bor@itsrm2:~smbsrc/source%> FOO=x eval 'sh -c "echo \$FOO"'
Correct. It expands to sh -c 'echo $FOO' and FOO is _not_ exported (and
should not).
bor@itsrm2:~smbsrc/source%> FOO=x eval 'FOO=bar sh -c "echo \$FOO"'
bar
If you really want to export something to command excuted in eval.
Why is it wrong. It is clean and consistent.
The workaround I gave (assignment after the
> eval) is really the best way of doing it. You can certainly argue
> it's not right to have eval as a special case, but I'd say exporting
> it rather than just setting it is the safest here.
>
Why? See above - you always can export it if needed.
>
> This is supposed to depend on the setting of POSIXBUILTINS.
'course you are right.
>
> Possibly the patch I sent should have a !isset(POSIXBUILTINS) wrapper?
>
Possibly, we don't need the patch at all?
/andrej
prev parent reply other threads:[~1998-12-11 13:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <19981211080558.46630@athenaeum.demon.co.uk>
1998-12-11 9:52 ` Peter Stephenson
1998-12-11 12:23 ` Andrej Borsenkow
1998-12-11 12:45 ` Peter Stephenson
1998-12-11 13:27 ` Andrej Borsenkow [this message]
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='001b01be250a$0cd92290$21c9ca95@mowp.siemens.ru' \
--to=borsenkow.msk@sni.de \
--cc=pws@ibmth.df.unipi.it \
--cc=zsh-workers@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).