bug-bash
[Top][All Lists]
Advanced

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

Re: GNU Bash v.4.4.23-5 built-in function 'set' produces variable output


From: Robert Elz
Subject: Re: GNU Bash v.4.4.23-5 built-in function 'set' produces variable outputs
Date: Mon, 22 Oct 2018 12:54:42 +0700

    Date:        Fri, 19 Oct 2018 16:21:27 -0400
    From:        Grisha Levit <address@hidden>
    Message-ID:  <address@hidden>

  | I guess it's a bit surprising that $_ is set to just the variable name
  | and not "the last argument to the previous command", which would be
  | the full assignment string.

Except that a var assign isn't a command at all, but something different, and
one could argue that with no command $_ should retain its value from whatever
was the last command.   But $_ has so many different uses in bash (and ksh93) 
and was a horrible botch in the first place (from when it was first added to 
ksh) so what it does isn't worth being concerned about - as best as can be
done, simply ignore it, and hope it eventually goes away....

kre

ps: it would be really nice if, in bash (and everywhere else) $_ could turn
into one of the magic vars which loses its special properties when unset.
Scripts that want to use $_ (if there are any, which I doubt) won't be
unsetting it and would continue to work, the rest of us (at least those of
us not insane enough to try and use it) could just "unset _" in .profile (etc)
and be done with it.




reply via email to

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