2014-09-27 23:12 Eric Blake napisał(a): > On 09/27/2014 02:57 PM, Arfrever Frehtes Taifersar Arahesis wrote: > > 2014-09-27 22:29 Eric Blake napisał(a): > >> Thankfully, bash already forbids trying to name a function 'a=b' > > > > It works in bash 4.3.26: > > > > $ function a=b() { echo A; } > > $ "a=b" > > A > > Oh, you used the 'function' keyword, coupled with NOT quoting the name > of the function. I was trying to create the name via quotation: > > $ bash -c 'a\=b () { echo hi; }; a\=b' > bash: `a\=b': not a valid identifier > bash: a=b: command not found > > Still, since I strongly believe that import/export and valid function > names should be the same set of characters, but that it would be > extremely difficult to unambiguously encode = into environment variable > function names, I think that we SHOULD take the step of forbidding '=' > in function names (the 'function' keyword should NOT be able to define > any function that cannot also be defined in isolation, nor which cannot > be imported from the environment using whatever improved implementation > we decide for function export/import).
Ability to export/import functions with "=" in function names could be achieved by not embedding function names in environmental variables and using a single BASH_FUNCTIONS environmental variable whose value would contain code of all exported functions (in format similar to `declare -fpx` / `export -fp`). -- Arfrever Frehtes Taifersar Arahesis
signature.asc
Description: This is a digitally signed message part.