Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- typeset -a argv
- typeset -a server
- typeset -a time
- ((server_p = 0))
- ((time_p = 0))
- while (($# > 0)); do
- if ((server_p)); then
- case "$1" in
- -*) ((server_p = 0)); ;;
- *) server=("${server[@]}" "$1"); shift; ;;
- esac
- continue
- fi
- if ((time_p)); then
- case "$1" in
- -*) ((time_p = 0)); ;;
- *) time=("${time[@]}" "$1"); shift; ;;
- esac
- continue
- fi
- case "$1" in
- -h) ((server_p = 1)); shift; ;;
- -t) ((time_p = 1)); shift; ;;
- *) argv=("${argv[@]}" "$1"); shift; ;;
- esac
- done
- if [[ ! -z ${time[0]} ]] && ((${#time[@]} > 2)); then
- echo time error
- fi
- echo normal "${argv[@]}"
- echo server "${server[@]}"
- echo time "${time[@]}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement