falldog 发表于 2018-8-20 11:51:50

shell $参数说明

# cat test.sh  #!/bin/bash
  printf "\$$ Shell本身的PID(ProcessID) is %s\n" "$$"
  printf "\$! Shell最后运行的后台Process的PID is %s\n" "$!"
  printf "\$? 最后运行的命令的结束代码(返回值) is %s\n" "$?"
  printf "\$*||\$@ 所有参数列表 is %s\n" "$*"
  printf "\$# 添加到Shell的参数个数 is %s\n" "$#"
  printf "\$0 Shell本身的文件名 is %s\n" "$0"
  printf "\$1~\$n 添加到Shell的各参数值。$1是第1参数、$2是第2参数…is %s\n" "$1"
  printf "\$1~\$n 添加到Shell的各参数值。$1是第1参数、$2是第2参数…is %s\n" "$2"

页: [1]
查看完整版本: shell $参数说明