0
我有如下一个bash脚本:模式匹配的bash脚本
#!/bin/bash
sh ~/Softwares/apache/kafka/kafka_2.11-0.10.0.0/bin/kafka-run-class.sh kafka.admin.ConsumerGroupCommand --describe --group $1 --zookeeper $2
我下面把这个脚本从我的终端:
kafka-describe my-kafka-consumer localhost:2181
我想现在通过只是一个变量而不是动物园管理员的地址,这样我就不必一直记住动物园管理员的地址。例如,我想能够调用的卡夫卡描述命令如下:
kafka-describe my-kafka-consumer integration - would run against the integration environment
kafka-describe my-kafka-consumer uat - would run against the uat environment
我可以再硬编码在不同的环境中我的脚本动物园管理员地址的位置。我对编写bash脚本完全陌生。有关如何做到这一点的任何建议?