Created
August 18, 2017 02:41
-
-
Save jintao-zero/fa9a40f0340c2072901b960e2f228607 to your computer and use it in GitHub Desktop.
bash argument case
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ $# -lt 1 ] | |
then | |
echo $0 opt | |
echo 'list (list all topic)' | |
echo 'describe topic (describe topic info)' | |
echo 'len topic (show topic len)' | |
fi | |
case $1 in | |
list) | |
./kafka-topics.sh --zookeeper 127.0.0.1:2181 --list | |
;; | |
describe) | |
./kafka-topics.sh --zookeeper 127.0.0.1:2181 --describe --topic $2 | |
;; | |
len) | |
./kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list 10.168.37.52:9092 --partitions 0 --topic $2 | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment