zsh-users
 help / color / mirror / code / Atom feed
* exporting environment variables to shell functions (maybe bug)
@ 2010-09-03  8:34 Joke de Buhr
  2010-09-03  8:54 ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Joke de Buhr @ 2010-09-03  8:34 UTC (permalink / raw)
  To: zsh-users

[-- 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 --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-09-03  9:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-03  8:34 exporting environment variables to shell functions (maybe bug) Joke de Buhr
2010-09-03  8:54 ` Peter Stephenson
2010-09-03  9:52   ` Joke de Buhr

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).