bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug: illegal function name?


From: Robert Elz
Subject: Re: bug: illegal function name?
Date: Mon, 21 Jan 2019 11:26:58 +0700

    Date:        Sun, 20 Jan 2019 19:50:35 -0800
    From:        Eduardo =?iso-8859-1?Q?A=2E_Bustamante_L=F3pez?= 
<dualbus@gmail.com>
    Message-ID:  <20190121035035.GC31763@system76-pc.vc.shawcable.net>

  | Changing the behavior of `unset f' to only ever unset variables means
  | potentially breaking existing scripts. Is the inconsistency reported severe
  | enough to make this change?

No, of course not, and no-one is suggesting that.   Rather make the
algorithm for "unset" when no flags are given be something like the
following (written in sh rather than C, as that's what most people on
this list should be able to follow easily) ...

for name
do
        if      case "${name}" in
                        ( [!A-Za-z_]* | *[!A-Za-z0-9_]*) false;;
                        (*) true;;
                esac &&
                eval test "''\${${name}+set}" = set
        then
                unset -v "${name}"
        else
                unset -f "${name}"
        fi
done

The actual implementation would most likely be nothing like that of course.

kre




reply via email to

[Prev in Thread] Current Thread [Next in Thread]