处理简单选项

5年以前  |  阅读数:502 次  |  编程语言:Shell 
#!/bin/bash
# extracting command line options as parameters

while [ -n "$1" ]
do
    case "$1" in
    -a) echo "Found the -a option";;
    -b) echo "Found the -b optins";;
    -c) echo "Found the -c optins";;
    *) echo "$1 is not a valid options";;
    esac
    shift
done

Copyright© 2013-2020

All Rights Reserved 京ICP备2023019179号-8