码迷,mamicode.com
首页 > 系统相关 > 详细

shell脚本练习04

时间:2018-09-15 01:16:59      阅读:207      评论:0      收藏:0      [点我收藏+]

标签:ted   simple   ESS   bsp   The   etop   pre   until   file   

 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

 

shell脚本练习04

标签:ted   simple   ESS   bsp   The   etop   pre   until   file   

原文地址:https://www.cnblogs.com/zhangyuanbo12358/p/9649659.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!