09 2013 档案

getopt vs getopts
摘要:getopt示例#!/bin/bashaflag=noargs=`getopt a: $@`if [ $? -ne 0 ]; then echo 'Usage: ...' exit 2fiset -- $argswhile [ $# -gt 0 ]do case "$1" in (-a) echo "-a was triggered, Parameter: $OPTARG" >&2;; (--) shift; non_option_arguments=$@; break;; (-*) echo "$0: error 阅读全文

posted @ 2013-09-27 17:18 JesseFang 阅读(622) 评论(0) 推荐(0)