DASH Shell discussions
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Rudolf Polzer <divverent@xonotic.org>
Cc: dash@vger.kernel.org
Subject: Re: Bug: temporary assignments vs shell function
Date: Thu, 14 Jul 2011 05:25:14 -0500	[thread overview]
Message-ID: <20110714102514.GA12904@elie> (raw)
In-Reply-To: <20110714100915.GA18946@div0.qc.to>

Rudolf Polzer wrote:

> So basically - when using an assignment for the duration of a shell command
> execution, an explicit subshell must be used in portable scripts, as
> interpretation of this construct differs among shells and thus cannot be relied
> on.

If "shell command execution" means "function call", then yes.

[...]
> exported() { :; }
>
> foo=bar exported
> sh -c 'echo $foo'

Ah, yuck.  On this machine:

 - dash does not export
 - zsh with "emulate sh" exports
 - ksh93 does not export
 - pdksh does not export
 - posh does not export
 - mksh exports
 - "bash -o posix" exports
 - busybox sh does not export

Fun.

  reply	other threads:[~2011-07-14 10:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-14  8:34 Bug: temporary assignments vs shell function Rudolf Polzer
2011-07-14  9:26 ` Jonathan Nieder
2011-07-14 10:09   ` Rudolf Polzer
2011-07-14 10:25     ` Jonathan Nieder [this message]
2011-07-31 22:19     ` Jilles Tjoelker
2011-08-01  5:59       ` Rudolf Polzer

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=20110714102514.GA12904@elie \
    --to=jrnieder@gmail.com \
    --cc=dash@vger.kernel.org \
    --cc=divverent@xonotic.org \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox