Greg Wooledge wrote:
I don't know what you mean. A function is not a name=value pair.
The name is the name of the function, the value is
what the function does.
declare -f hw='() { echo "Hello World\n"; }'
The above has a name on the left side, and the value of the name
is on the right side. One can reformat it so it looks like a
function, but that's eye-candy.
Isn't this a legal variable assignment?:
hw='() { echo "Hello World\n"; }'
the left is the name and the right side is a string-value.
Now suppose you could set the 'f' flag via declare:
declare -f hw
It would move 'hw' out of the variable space and into the function
space (since vars and funcs are in separate spaces in bash) where you
could then execute it.
In bash instead of just allowing the flag change, you need to go through
'eval' to enable execution on it,
But it theoretically could be enabled by allow the 'f' flag to be set
when it isn't.