变量说明: 
   $$ 
   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 ~]$ bashparams.sh 123456 QQ
   The complete listis24249
   The complete listis 
   The complete listis0
   The complete listis123456 QQ
   The complete listis123456
   The complete listisQQ
   The complete listis2
   The complete listisparams.sh
   The complete listis123456
   The complete listisQQ
   Have a nice day!!!

随机推荐

  1. 如何使用setup.py文件

    setup.py文件的使用:% python setup.py build #编译% python setup.py install    #安装% python setup.py sdist     ...

  2. 【SpringMVC】SpringMVC系列3之@PathVariable映射URL占位符参数

    3.@PathVariable映射URL占位符参数 3.1.概述 带占位符的 URL 是 Spring3.0 新增的功能,该功能在SpringMVC 向 REST 目标挺进发展过程中具有里程碑的意义. ...

  3. Segment Tree Build I & II

    Segment Tree Build I The structure of Segment Tree is a binary tree which each node has two attribut ...

  4. local variable 'xxx' referenced before assignment

    这个问题很囧,在外面定义了一个变量 xxx ,然后在python的一个函数或类里面引用这个变量,并改变它的值,结果报错local variable 'xxx' referenced before as ...

  5. 【转】PowerDesigner使用方法小结

    本文转自:http://www.cnblogs.com/afarmer/archive/2012/11/05/2755327.html PowerDesigner多用来进行数据库模型设计,具有SQL语 ...

  6. web iphone css 兼容性

    解决IPHONE网页兼容(部分字号变大): body{-webkit-text-size-adjust:none;}

  7. CodeForces - 405A

    Gravity Flip Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u Submit ...

  8. ImageView中XML属性src和background的区别

    background会根据ImageView组件给定的长宽进行拉伸,而src就存放的是原图的大小,不会进行拉伸. src是图片内容(前景),bg是背景,可以同时使用. 此外:scaleType只对sr ...

  9. 运行基准测试hadoop集群中的问题:org.apache.hadoop.ipc.RemoteException: java.io.IOException: File /benchmarks/TestDFSIO/io_data/test_

    在master(即:host2)中执行 hadoop jar hadoop-test-1.1.2.jar DFSCIOTest -write -nrFiles 12 -fileSize 10240 - ...

  10. Java vararg(动态参数)的应用

    可变参数在JDK 1.5添加,刚才知道的. 以下来自<Java泛型和集合>一书. 将参数打包成一个数组传入方法中是一件让人讨厌的事,在jdk1.5中加入了一个新的功能称为vararg(动态 ...