变量说明: 
$$ 
Shell本身的PID(ProcessID) 
$! 
Shell最后运行的后台Process的PID 
$? 
最后运行的命令的结束代码(返回值) 
$- 
使用Set命令设定的Flag一览 
$* 
所有参数列表。如"$*"用「"」括起来的情况、以"$1 $2 … $n"的形式输出所有参数。 
$@ 
所有参数列表。如"$@"用「"」括起来的情况、以"$1" "$2" … "$n" 的形式输出所有参数。 
$# 
添加到Shell的参数个数 
$0 
Shell本身的文件名 
$1~$n 
添加到Shell的各参数值。$1是第1参数、$2是第2参数…。 

示例:

1 #!/bin/bash
 2 #
 3 printf "The complete list is %s\n" "$$"
 4 printf "The complete list is %s\n" "$!"
 5 printf "The complete list is %s\n" "$?"
 6 printf "The complete list is %s\n" "$*"
 7 printf "The complete list is %s\n" "$@"
 8 printf "The complete list is %s\n" "$#"
 9 printf "The complete list is %s\n" "$0"
10 printf "The complete list is %s\n" "$1"
11 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

Have a nice day!!!

最新文章

  1. CD管理和检索软件比较
  2. 安装和配置SQL Server 2016 With SP1
  3. python 字符串format使用
  4. 解决IE6中PNG图出现灰色背景问题
  5. 转:ibatis配置简介
  6. JAVA收到网络报文的IP是::1,怎么回事?
  7. 来,创建一个高效的IMEI编码生成器
  8. 浅谈无线传感器和无线传感器网络
  9. 多元线性回归分析spss结果解读_多重线性回归分析SPSS操作与解读
  10. DCT--离散余弦变换
  11. KANBAN专题一:KANBAN管理的基本系统操作
  12. 99% 的程序员想不到的一个技巧,绝对让领导眼前一亮,好感倍增!
  13. 从容不迫——《稀缺》的读书笔记范文3700字
  14. go 获得 mysql 实际运行 SQL_mysql对标准sql的goup by进行了扩展 | 学步园
  15. 联发科服务器芯片,基于MTK7623N芯片的香蕉派 BPI-R2 ,智能通信物联网网关开发平台...
  16. oracle的crs是什么,Oracle CRS简介
  17. 推荐系统常用的评价指标:HR、NDCG、MRR
  18. Leetcode:701. 二叉搜索树中的插入操作(C++)
  19. drcom linux怎么运行,解决64位Ubuntu Linux下不能使用drcom上网的3种方法(下)
  20. 高通QAC4012平台 支持三大物联网标准

热门文章

  1. C++实现两个矩阵相乘
  2. 使用Intent来启动Activity并传递参数
  3. CSS:你真的会用 z-index 吗?
  4. Django连接postgresql数据库
  5. Spring boot 字符集编码
  6. Swift 添加自定义响应事件
  7. 二分查找or折半查找
  8. ubuntu系统下gedit 打开GBK字符集编码文件出现乱码问题解决办法
  9. C#:关于双引号的输出
  10. Java集合框架体系(超详细)