发布时间: 2018-02-08 16:39:35
shell常见的系统变量解析:
$0 当前程序名称
$n 当前程序的第n个参数,n=1,2,。。。
$* 当前程序的所有参数(不包括程序本身)
$# 当前程序的参数个数(不包括程序本身)
$? 命令或程序执行完后的状态,一般返回0表示执行成功
sh var.sh abc edf
#!/bin/bash
#define path variables
#by authors Andyu 2018
echo "##############"
echo "The \$1 is $1"
echo "The \$2 is $2"
echo "The \$? is $?"
echo "The \$* is $*"
echo "The \$# is $#"
上一篇: {红帽 RHCA}RH318-红帽虚拟化
下一篇: {思科 CCNA-SEC}Trunk原理