当前位置: 技术问答>linux和unix
bash 怎么获取前一条命令
来源: 互联网 发布时间:2016-09-25
本文导语: 问题如标题,针对的只是bash,csh的方法就不用说了,并且history 1 这种也不用了,有没有其他命令? | [root@test ~]# man bash Special Parameters _ At shell startup, set to the absolute pathname ...
问题如标题,针对的只是bash,csh的方法就不用说了,并且history 1 这种也不用了,有没有其他命令?
|
[root@test ~]# man bash
Special Parameters
_ 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.
[root@test ~]# bash -version
GNU bash, version 3.2.25(1)-release (i686-redhat-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.
[root@test ~]# echo $_
-version
Special Parameters
_ 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.
[root@test ~]# bash -version
GNU bash, version 3.2.25(1)-release (i686-redhat-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.
[root@test ~]# echo $_
-version
|
man bash
or
RTFW
ftp://ftp.cwru.edu/pub/bash/FAQ
|
上方向键
|
还是没弄懂,呵呵