Usage of $ sign in Bash

脚本名称:$0

PID:$$

参数个数:$#

脚本返回值:$?

第x个参数:$x

第10个以上的参数加大括号:${10}

所有参数:$@

#!/bin/bash
echo "The program $0 is now running"
echo "The progress PID is $$"
echo "The last progress PID is $$"
echo "The number of parameter is $# "
echo "The return code of last command is $?"
echo "The first parameter is $1"
echo "The second parameter is $2"
echo "The parameters are: $*"
echo "Again, the parameters are: $@"

Disclaimer
  1. License under CC BY-NC 4.0
  2. Copyright issue feedback me#imzye.me, replace # with @
  3. Not all the commands and scripts are tested in production environment, use at your own risk
  4. No privacy information is collected here
Try my iOS App