[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] Why remove the export attribute of $_ every time after a
From: |
ziyunfei |
Subject: |
Re: [Help-bash] Why remove the export attribute of $_ every time after a simple command is executed |
Date: |
Tue, 8 Sep 2015 09:44:54 +0800 |
On Sep 8, 2015, at 8:21 AM, Chet Ramey <address@hidden> wrote:
>
> Because $_ has different meanings in different contexts. It only expands
> to the final argument of a simple command when that command is executed,
> and that is passed to that command in its environment. It also expands
> to the current mail file when checking for mail and is initialized (if not
> already set) to the name of the shell at shell startup.
>
Thanks for replying, actually I know $_ has three different meanings depending
on when and where it's used. but I just want to ask: what will happen if we
allow $_ to be an environment variable when it represents the last arg, like
ksh does.
$ echo 1
1
$ export | grep '_='
_=1
$ ksh --version
version sh (AT&T Research) 93u 2011-02-08