functions can fully unset local vars in other scopes

2022-07-28 Thread Emanuele Torre
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/bin' -DSTANDARD_UTILS_PATH='/usr/bin' -DSYS_BASHRC='/etc/bash

Re: functions can fully unset local vars in other scopes

2022-07-28 Thread Emanuele Torre
> It may be nice to also add a "force" option for `unset' that makes it > actually unset the variable if it is `local'. Since this could be > useful in some cases and it won't be possible after the behaviour is > changed. Clarification I meant that it should fully undeclare local variables i

Re: functions can fully unset local vars in other scopes

2022-07-28 Thread Greg Wooledge
On Fri, Jul 29, 2022 at 03:59:07AM +0200, Emanuele Torre wrote: > This enables defininng a "really_unset" function like so: > > really_unset () { unset "$@" ;} > > Which may be useful I guess. https://lists.gnu.org/archive/html/bug-bash/2010-05/msg00045.html https://fvue.nl/wiki/Bash:

Re: functions can fully unset local vars in other scopes

2022-07-28 Thread Koichi Murase
2022年7月29日(金) 10:59 Emanuele Torre : > Description: > `bash' does not let `unset' fully undeclare local variables. (so that > they can be used later as `local' variables without needing to > redeclare them I assume.) > > [...] > > However, other functions are allowed to delete those v

Re: functions can fully unset local vars in other scopes

2022-07-28 Thread Emanuele Torre
Thank you, Koichi and Greg. I didn't notice that this was intended and documented. Also it is good to know that `localvar_unset' exists. Cheers.