Shell傳參的兩種方法

1、$一、$2...$n接收參數 這個方法比較簡單,直接上代碼:sql 腳本:shell #/bin/bash/ echo $1,$2,$3 執行命令: bash test.sh 1 2 3 執行結果:ubuntu 1,2,3 2、getopts 先上代碼: 腳本1(參數不跟值):bash #/bin/bash/ while getopts "ab" opt; do case $opt i
相關文章
相關標籤/搜索