变量说明:

$$        Shell自己PID(ProcessID)
$! Shell背景上次执行Process的PID
$? 命令的结束代码(返回值)
$- 使用Set命令设定的Flag一览
$* 全部參数列表。如"$*"用「"」括起来的情况、以"$1 $2 … $n"的形式输出全部參数。
$@ 全部參数列表。如"$@"用「"」括起来的情况、以"$1" "$2" … "$n" 的形式输出全部參数。 $# 加入到Shell的參数个数
$0 Shell本身的文件名称
$1~$n 加入到Shell的各參数值。$1是第1參数、$2是第2參数…。

演示样例:

#!/bin/bash
#
printf "The complete list is %s\n" "$$"
printf "The complete list is %s\n" "$!"
printf "The complete list is %s\n" "$?"
printf "The complete list is %s\n" "$*"
printf "The complete list is %s\n" "$@"
printf "The complete list is %s\n" "$#"
printf "The complete list is %s\n" "$0"
printf "The complete list is %s\n" "$1"
printf "The complete list is %s\n" "$2"

结果:

[Aric@localhost ~]$ bash params.sh 123456 QQ
The complete list is 24249
The complete list is
The complete list is 0
The complete list is 123456 QQ
The complete list is 123456
The complete list is QQ
The complete list is 2
The complete list is params.sh
The complete list is 123456
The complete list is QQ

很多其它解释见以下文档

下载地址:http://www.tldp.org/LDP/abs/abs-guide.pdf

版权声明:本文博主原创文章。博客,未经同意不得转载。

随机推荐

  1. Spring相框

    1.什么是Spring相框?Spring有哪些主要模块框架? Spring框架是一个为Java应用程序的开发提供了综合.广泛的基础性支持的Java平台. Spring帮助开发人员攻克了开发中基础性的问 ...

  2. cocos2d-x博客网站推荐和牛逼的教程

    Cocos2d-x网站列表 CocoaChina(官方网站,不解释)www.cocoachina.com/ 泰然网(貌似最近有很多不错的文章,不过早期的文章质量一般)www.ityran.com/ C ...

  3. svnkit添加节点

    package com.repositoryclient.svnoptions; import org.tmatesoft.svn.core.SVNException; import org.tmat ...

  4. c#与oracle数据库连接池

    c#与oracle数据库连接池 在做一个项目,中间要使用webservice和oracle数据库.我在服务端做了用户身份认证,也就是使用session传递用户的登陆信息.在测试时,当用户少的时候,没有 ...

  5. cocos2dx A* + tiledMap

    本文转自:http://blog.csdn.net/w18767104183/article/category/1757765 前面一章讲了cocos2dx 中使用A星算法 这章中讲 A*结合tile ...

  6. java中HashMap在多线程环境下引起CPU100%的问题解决(转)

    最近项目中出现了Tomcat占用CPU100%的情况,原以为是代码中出现死循环,后台使用jstack做了dump,发现是系统中不合理使用HashMap导致出现了死循环(注意不是死锁). 产生这个死循环 ...

  7. Cantor的数表 【找规律】

    小俞同学,近期勤学苦练数学,对一种数表产生了兴趣. 数表例如以下: 1/1 1/2 1/3 1/4 1/5 2/1 2/2 2/3 2/4 3/1 3/2 3/3 4/1 4/2 5/1 她冥思苦相了 ...

  8. Windows Phone开发(30):图形

    原文:Windows Phone开发(30):图形 图形如矩形.椭圆.路径等都从Shape类派生,它们一般表示规则或不规则图形,这些图形都是简单的二维图形,我相信大家都能理解的. 例一:矩形. 请看下 ...

  9. 解决ubuntu 14.04在显示屏电缆被拔出的问题

    我是一个ubuntu14.04和win7双系统.于win在正常的网络.但在ubuntu网络连接有一直显示线被拔掉,您只能连接到无线Wi-Fi,没有有线网络. 关于这个问题,,最终找到的一种方式,这是进 ...

  10. listary文件查找程序下载和使用

    资源:PHP开发学习门户网站 地址:http://bbs.phpthinking.com/forum.php?mod=viewthread&tid=173 Listary 是一款有用的国产Wi ...