Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- getopt --test > /dev/null
- if [[ $? -ne 4 ]]; then
- echo "getopt --test failed in this environment."
- exit 1
- fi
- function quit {
- echo "$1"
- exit 1
- }
- # Option strings
- LONG="producer-dir:,consumer-dir:,username:,password:,url:,kafka-host:,checkpoint-dir:"
- # read the options
- OPTS=$(getopt --longoptions ${LONG} --name "$0" -- "$@")
- if [ $? != 0 ]; then
- quit "Failed to parse options...exiting."
- fi
- eval set -- "$OPTS"
- # extract options and their arguments into variables.
- while true ; do
- case "$1" in
- --producer-dir )
- PRODUCER_DIR="$2"
- shift 2
- ;;
- --consumer-dir )
- CONSUMER_DIR="$2"
- shift 2
- ;;
- --username )
- USERNAME="$2"
- shift 2
- ;;
- --password )
- PASSWORD="$2"
- shift 2
- ;;
- --url )
- URL="$2"
- shift 2
- ;;
- --kafka-host )
- KAFKA_HOST="$2"
- shift 2
- ;;
- --checkpoint-dir )
- CHECKPOINT_DIR="$2"
- shift 2
- ;;
- -- )
- shift
- break
- ;;
- *)
- echo "Internal error!"
- exit 1
- ;;
- esac
- done
Add Comment
Please, Sign In to add comment