linux-tutorial/codes/shell/示例脚本/输入和输出/处理简单选项.sh
2019-10-10 08:56:31 +08:00

15 lines
297 B
Bash

#!/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