当前位置:网站首页>Shell 查看帮助

Shell 查看帮助

2022-06-23 00:35:00 ghostwritten

Shell 查看帮助


Shell 脚本添加查看帮助,让他人更容易看懂理解。

1

help()
{
    
	header
	echo
	echo 'Usage: cckiller [OPTIONS] [N]'
	echo 'N : number of tcp/udp connections (default 100)'
	echo
	echo 'OPTIONS:'
	echo "-h | --help: Show this help screen"
	echo "-k | --kill: Block the offending ip making more than N connections"
	echo '-s | --show: Show The TOP "N" Connections of System Current'
	echo "-b | --banip: Ban The IP or IP subnet like cckiller -b 192.168.1.1"
	echo "-u | --unban: Unban The IP or IP subnet which is in the BlackList of iptables"
	echo
}

if [ $# -lt 2 ]; then
	help
fi

2

# Notes:
# - Please install "jq" package before using this driver.
usage() {
    
	err "Invalid usage. Usage: "
	err "\t$0 init"
	err "\t$0 mount <mount dir> <json params>"
	err "\t$0 unmount <mount dir>"
	exit 1
}

err() {
    
	echo -ne $* 1>&2
}

...

if [ $# -lt 2 ]; then
	usage
fi
....

原网站

版权声明
本文为[ghostwritten]所创,转载请带上原文链接,感谢
https://ghostwritten.blog.csdn.net/article/details/125409688