linux-tutorial/codes/shell/输入和输出/处理简单选项.sh

15 lines
272 B
Bash
Raw Normal View History

2019-10-29 18:22:19 +08:00
#!/usr/bin/env 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