./g1.sh q w e r 5个参数 bash命令 获取 命令实际的参数 shell文件名称$0 第一个参数$1第2个参数$2 最后一个参数$#;参数个数$#个;所有的参数列出来$*

# ./g1.sh q w e r t
./g1.sh q w e r
5个参数
number is q w e r t
[root@localhost get]# cat g1.sh
#!/bin/bash
# -*- coding: utf-8 -*-
#--------------------------------------------------
#Author:c 
#Email:[email protected]
#FileName:getinfo.sh
#Function:create a file called hardware-software-info-neokylin.txt which print all info of OS
#Version:1.0
#Version:2.0 --20190520
#Version:4.0 --20190716
##Version:5.0 --20190722
##Version:5.1 --20190902
##Version:.0 --2019
##Version:.0 --2019
##Version:.0 --20190
#
##
#Version:
#Version:
#Created:2019-04-17
#--------------------------------------------------
###this shell is to print all of the hardware-software-info in a file
####three varibles :basepath
###chang address aa bb
echo "$0 $1 $2 $3 $4 "
echo "$#个参数"
echo "number is $*"

[root@localhost get]#

猜你喜欢

转载自www.cnblogs.com/xuanbjut/p/11907844.html
今日推荐