开发者

Explain the o/p of echo $_

When I do

$ du
$ echo $_

I get o/p as du. Why is that ?

About - man bash says: "At shell startup, set to the absolute pathname used to invoke the shell or shell script being executed as passed in the environment or argument list. Subsequently, expands to the l开发者_如何学JAVAast 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 checking mail, this parameter holds the name of the mail file currently being checked."

So $_ should be empty, there is no argument to du in the example above.


The first argument is always the name of the executed program or script.

In this case last = first.

"...the name by which the program was called..."

Link

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜