./g1.sh qwer 5 parameters bash command to get the actual parameter command shell file name first parameter $ 0 $ 1 $ 2 second argument last argument $ #; # $ a number of arguments; all the parameters listed $ *

# ./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]#

Guess you like

Origin www.cnblogs.com/xuanbjut/p/11907844.html