bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Issues with exported functions


From: Geir Hauge
Subject: Re: Issues with exported functions
Date: Thu, 25 Sep 2014 11:14:31 +0200

2014-09-25 10:43 GMT+02:00 Davide Brini <dave_br@gmx.com>:

> I'm not arguing about anything, I just have a question. I understand that
> with the current method used to export functions, it is not possible to
> export a variable to a child whose value begins exactly with the characters
> in question. A quick test seems to confirm that:
>
> $ x='() { echo a; }' bash -c 'echo "$x"'
>
> $ x='()  { echo a; }' bash -c 'echo "$x"'
> ()  { echo a; }
>
>
> So is there a way to be able to export variables with arbitrary values,
> including '() {' ?  Sorry if this has been discussed before.
>

There's the -p flag, but it has other side effects

$ x='() { echo a; }' bash -pc 'echo "$x"'
() { echo a; }

I also dislike that it parses exported functions by default; it violates
the "don't treat data as code" rule. Sure would be nice if there was a
separate flag that only disables parsing of exported functions.

-- 
Geir Hauge


reply via email to

[Prev in Thread] Current Thread [Next in Thread]