shell脚本练习01

 1 #########################################################################
  2 # File Name: 4.5.sh
  3 # Author: zhang yunabo
  6 #########################################################################
  7 #!/bin/bash
  8 minparams=10
  9 echo
 10 
 11 echo "the name of this script is \"$0\""
 12 echo "the name of this script is \"`basename $0`\""
 13 
 14 echo
 15 
 16 if [ -n $1 ]
 17 then 
 18     echo "Parameters is $1"
 19 fi  
 20 
 21 if [ -n "$2" ]
 22 then
 23     echo "Parameters 2 is $2"
 24 fi
 25 
 26 if [ -n "${10}" ]
 27 then 
 28     echo "Parameters 10 is ${10}"
 29 fi  
 30 echo "-------------------"
 31 echo "all parameters are:"$*""
 32 
 33 if [ $# -lt "$minparams" ]
 34 then 
 35     echo                           
 36     echo "this script needs at last $minparams parameters."
 37 fi
 38 echo
 39 exit 0
 40 

 

posted @ 2018-09-05 20:23  荣码一生  阅读(119)  评论(0编辑  收藏  举报