Shell变量$#,$@,$0,$1,$2

来源:互联网 发布:vpn网络加速器 编辑:程序博客网 时间:2024/05/20 18:18

The Linux Documentation Project (LDP) is working on developing good, reliable documentation for the Linux operating system. The overall goal of the LDP is to collaborate in taking care of all of the issues of Linux documentation, ranging from online documentation (man pages, HTML, and so on) to printed manuals covering topics such as installing, using, and running Linux. Here is the Linux Documentation Project Manifesto and Copyright License for LDP works.

http://www.tldp.org/LDP/abs/abs-guide.pdf

  • $$

    Shell本身的PID(ProcessID)

  • $!

    Shell最后运行的后台Process的PID

  • $?

    最后运行的命令的结束代码(返回值)

  • $*

    所有参数列表,字串形式

  • $@

    所有参数列表,数组形式

  • $#

    添加到Shell的参数个数

  • $0

    Shell本身的文件名

  • $1

    添加到Shell的第一个参数

原创粉丝点击