Hi,

my assumption was that Bash's "printf" builtin implicitly defines a local
variable when used inside a function like so:

    function foobar { printf -v foo bar; }
    foobar
    declare -p foo
    # Prints "bar" from the global "foo" variable.

But instead I have to declare the "foo" variable to be a "local" member of
the "foobar" function like so:

    unset -v foo
    function foobar { local foo=; printf -v foo bar; }
    foobar
    declare -p foo
    # Prints an error message saying that there is no "foo" defined.

Cheers
Tim

Reply via email to