zsh-users
 help / color / mirror / code / Atom feed
From: Joke de Buhr <joke@seiken.de>
To: zsh-users@zsh.org
Subject: exporting environment variables to shell functions (maybe bug)
Date: Fri, 3 Sep 2010 10:34:30 +0200	[thread overview]
Message-ID: <201009031034.47905.joke@seiken.de> (raw)

[-- Attachment #1: Type: Text/Plain, Size: 874 bytes --]

I've ask this question a couple of days before but I didn't get any response 
[1]. I think this may be a bug.


If I define a shell function like this one:

  do_print() {
    print "__${NAME}__"  # print environment variable "NAME"
  }

and later call the function while setting the environment variable "NAME"

  NAME="hello" do_print

the output is "__hello__" as everybody would expect. But if the function is 
called this way

  NAME="hello"                    # set NAME (no export)
  NAME="::${NAME}::" do_print     # export something as NAME containing $NAME

the output is "__::::__" instead of "__::hello::__". If the same think is done 
using a command instead of a shell function the output is "__::hello::__". 
Refer to the older email [1] for a listing of different test cases.



[1] http://www.zsh.org/mla/users/2010/msg00644.html

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 706 bytes --]

             reply	other threads:[~2010-09-03  8:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-03  8:34 Joke de Buhr [this message]
2010-09-03  8:54 ` Peter Stephenson
2010-09-03  9:52   ` Joke de Buhr

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=201009031034.47905.joke@seiken.de \
    --to=joke@seiken.de \
    --cc=zsh-users@zsh.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.
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).