Hi together, short: is there any way to get informed about unset local variable while having option 'nounset' activated?
Long: the problem with 'local' is that variable declared this way are visible inside the children, too. So the behaviour of option 'nounset' depends on the way a function is called - either with a caller function with the (locally) unset variable already set or without one. Lets have a look at my example script: ------------------------------------------------------- set -o nounset function g() { echo "g: myvar=$myvar" } function f() { local myvar="test" echo "f: myvar=$myvar" g } f ------------------------------------------------------- This way all is fine for bash but not for me since myvar is not set inside g(). So if I call g() directly instead of f() then 'nounset' gives me the error that I want. This results into the question whether it is possible to get an error for such situations, too? Thanks in advance! Kind regards -- Heiko Nardmann