【Linux】Shell 参数解析

#!/bin/sh

APP_NAME=
while getopts "a:" opt;
do
    case $opt in
        a)
            APP_NAME=$OPTARG
            echo "APP_NAME is $APP_NAME"
            ;;
        \?)
            echo "error unrecognized parameter."
            exit 1
            ;;
    esac
done

猜你喜欢

转载自www.cnblogs.com/jzsg/p/10951542.html