Re: functions can be created with dotted name but not removed
Michael O'Donnell wrote: > Bash Version: 4.0 > Patch Level: 28 > Release Status: release > > Description: > > A bash function with a dot in its name can be created and used with no > problems but cannot be removed - the "unset" command chokes on the name. It's true -- the shell allows you to define a function with an invalid name containing a dot (in retrospect, probably not the wisest choice). Since `unset' without options assumes it is unsetting a variable, and bash doesn't allow you to create a variable whose name contains a dot, you need to tell unset you're removing a function: `unset -f f.dot'. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/
Re: functions can be created with dotted name but not removed
On Dec 4, 9:25 am, "Michael O'Donnell" wrote: > Configuration Information [Automatically generated, do not change]: > Machine: i486 > OS: linux-gnu > Compiler: gcc > Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i486' > -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i486-pc-linux-gnu' > -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL > -DHAVE_CONFIG_H -I. -I../bash -I../bash/include -I../bash/lib -g -O2 > -Wall > uname output: Linux e521 2.6.30-2-686 #1 SMP Sat Sep 26 01:16:22 UTC 2009 > i686 GNU/Linux > Machine Type: i486-pc-linux-gnu > > Bash Version: 4.0 > Patch Level: 28 > Release Status: release > > Description: > > A bash function with a dot in its name can be created and used with no > problems but cannot be removed - the "unset" command chokes on the name. > > Repeat-By: > > This sequence yields the expected results: > > function f() { echo $FUNCNAME ; } > f > unset f > > ...while this sequence fails during the unset phase with the complaint > that the name is not a valid identifier: > > function f.dot() { echo $FUNCNAME ; } > f.dot > unset f.dot I can confirm that this behavior is also present in 3.2.49(23)-release and 4.0.33(1)-release.
Re: functions can be created with dotted name but not removed
Michael O'Donnell wrote: > A bash function with a dot in its name can be created and used with no > problems but cannot be removed - the "unset" command chokes on the name. > > > Repeat-By: > > This sequence yields the expected results: > > function f() { echo $FUNCNAME ; } > f > unset f > > ...while this sequence fails during the unset phase with the complaint > that the name is not a valid identifier: > > function f.dot() { echo $FUNCNAME ; } > f.dot > unset f.dot Try unset -f f.dot
functions can be created with dotted name but not removed
Configuration Information [Automatically generated, do not change]: Machine: i486 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i486' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i486-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I../bash -I../bash/include -I../bash/lib -g -O2 -Wall uname output: Linux e521 2.6.30-2-686 #1 SMP Sat Sep 26 01:16:22 UTC 2009 i686 GNU/Linux Machine Type: i486-pc-linux-gnu Bash Version: 4.0 Patch Level: 28 Release Status: release Description: A bash function with a dot in its name can be created and used with no problems but cannot be removed - the "unset" command chokes on the name. Repeat-By: This sequence yields the expected results: function f() { echo $FUNCNAME ; } f unset f ...while this sequence fails during the unset phase with the complaint that the name is not a valid identifier: function f.dot() { echo $FUNCNAME ; } f.dot unset f.dot
functions can be created with dotted name but not removed
Configuration Information [Automatically generated, do not change]: Machine: i486 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i486' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i486-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I../bash -I../bash/include -I../bash/lib -g -O2 -Wall uname output: Linux e521 2.6.30-2-686 #1 SMP Sat Sep 26 01:16:22 UTC 2009 i686 GNU/Linux Machine Type: i486-pc-linux-gnu Bash Version: 4.0 Patch Level: 28 Release Status: release Description: A bash function with a dot in its name can be created and used with no problems but cannot be removed - the "unset" command chokes on the name. Repeat-By: This sequence yields the expected results: function f() { echo $FUNCNAME ; } f unset f ...while this sequence fails during the unset phase with the complaint that the name is not a valid identifier: function f.dot() { echo $FUNCNAME ; } f.dot unset f.dot