Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #14721
| Path | csiph.com!goblin3!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail |
|---|---|
| From | Greg Wooledge <wooledg@eeg.ccf.org> |
| Newsgroups | gnu.bash.bug |
| Subject | Re: GNU Bash v.4.4.23-5 built-in function 'set' produces variable outputs |
| Date | Fri, 19 Oct 2018 15:50:26 -0400 |
| Lines | 45 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.2472.1539978662.1284.bug-bash@gnu.org> (permalink) |
| References | <CAM_8-CiC=2-wY+y9GpRutzuOhom3q5ayS54sdH=F_w106WMj4Q@mail.gmail.com> |
| NNTP-Posting-Host | lists.gnu.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 8bit |
| X-Trace | usenet.stanford.edu 1539978663 3464 208.118.235.17 (19 Oct 2018 19:51:03 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| Cc | bug-bash@gnu.org |
| To | Ricky Tigg <ricky.tigg@gmail.com> |
| Envelope-to | bug-bash@gnu.org |
| Mail-Followup-To | Ricky Tigg <ricky.tigg@gmail.com>, bug-bash@gnu.org |
| Content-Disposition | inline |
| In-Reply-To | <CAM_8-CiC=2-wY+y9GpRutzuOhom3q5ayS54sdH=F_w106WMj4Q@mail.gmail.com> |
| User-Agent | NeoMutt/20170113 (1.7.2) |
| X-detected-operating-system | by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] |
| X-Received-From | 139.137.100.1 |
| X-BeenThere | bug-bash@gnu.org |
| X-Mailman-Version | 2.1.21 |
| Precedence | list |
| List-Id | Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org> |
| List-Unsubscribe | <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe> |
| List-Archive | <http://lists.gnu.org/archive/html/bug-bash/> |
| List-Post | <mailto:bug-bash@gnu.org> |
| List-Help | <mailto:bug-bash-request@gnu.org?subject=help> |
| List-Subscribe | <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe> |
| Xref | csiph.com gnu.bash.bug:14721 |
Show key headers only | View raw
On Fri, Oct 19, 2018 at 09:41:41PM +0200, Ricky Tigg wrote:
> Built-in function 'set' produces variable outputs.
> $ export SSLKEYLOGFILE=/home/user/test
>
> $ set | grep SSL
> SSLKEYLOGFILE=/home/user/test
> _=SSLKEYLOGFILE
This is not a bug. The Special Parameter "_" is explained in the manual:
_ At shell startup, set to the absolute pathname used to invoke
the shell or shell script being executed as passed in the envi‐
ronment or argument list. Subsequently, expands to the last
argument to the previous command, after expansion. Also set to
the full pathname used to invoke each command executed and
placed in the environment exported to that command. When check‐
ing mail, this parameter holds the name of the mail file cur‐
rently being checked.
What you're seeing is simply that the varying content of $_ sometimes
matches your grep, and sometimes not.
wooledg:~$ true
wooledg:~$ echo "$_"
true
wooledg:~$ true blue
wooledg:~$ echo "$_"
blue
wooledg:~$ true blue | grep foo
wooledg:~$ echo "$_"
wooledg:~$ X=Y
wooledg:~$ echo "$_"
wooledg:~$ export X=Y
wooledg:~$ echo "$_"
X
In your example, after the export command, $_ contains "SSLKEYLOGFILE"
and therefore it matches your first grep. However, after that grep
command finishes, $_ is empty (I don't know why -- possibly because each
"command" of the pipeline runs in a subshell?), and so it does NOT match
your second grep.
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
Re: GNU Bash v.4.4.23-5 built-in function 'set' produces variable outputs Greg Wooledge <wooledg@eeg.ccf.org> - 2018-10-19 15:50 -0400
csiph-web