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
相关文章
相关标签/搜索