zoukankan      html  css  js  c++  java
  • ./g1.sh q w e r 5个参数 bash命令 获取 命令实际的参数 shell文件名称$0 第一个参数$1第2个参数$2 最后一个参数$#;参数个数$#个;所有的参数列出来$* 返回值$? 正确0 失败1

    # ./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:libizaking@163.com
    #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]#

  • 相关阅读:
    Python运算符及逻辑运算
    Python编码、流程控制、格式化输出
    Docker私有仓库Harbor部署与使用
    react
    理事会
    关于elementui form表单过长,看不到未填项
    js
    vue 父子传值
    养生
    html知识点
  • 原文地址:https://www.cnblogs.com/xuanbjut/p/11907844.html
Copyright © 2011-2022 走看看