Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

exporting environment variables to shell functions (maybe bug)

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: signature.asc
Description: This is a digitally signed message part.

Messages sorted by: Reverse Date, Date, Thread, Author