shell脚本练习04
1 ######################################################################### 2 # File Name: 9-5.sh 3 # Author: zhang yunabo 4 # mail: ma6174@163.com 5 # Created Time: Fri 14 Sep 2018 08:23:56 PM EDT 6 ######################################################################### 7 #!/bin/bash 8 getopt_simple() 9 { 10 echo "getopt_simple" 11 echo "Parameters are $@" 12 until [ -z $1 ] 13 do 14 echo "Processing Parameter of '$1'" 15 if [ ${1:0:1} = '/' ] 16 then 17 tmp=${1:1} 18 parameter=${tmp%%=*} 19 value=${tmp##*=} 20 echo "Parameter:'$parameter',value:'$value'" 21 eval $parameter=$value 22 fi 23 shift 24 done 25 } 26 27 getopt_simple $* 28 29 echo "test is $test" 30 echo "test2 is '$test2'" 31 exit 0 32 33 sh getopt_simple.sh /test=value1 /test2/value2