Трюки оболочки
Все программы varnish можно вызвать с единственным аргументом --optstring для запроса их getopt() спецификации, что упрощает скрипты-обертки:
optstring=$(varnishfoo --optstring)
while getopts "$optstring" opt
do
case $opt in
n)
# handle $OPTARG
;;
# handle other options
*)
# ignore unneeded options
;;
esac
done
varnishfoo "$@"
# do something with the options
Copyright © 2006 Verdens Gang AS
Copyright © 2006–2020 Varnish Software AS
Licensed under the BSD-2-Clause License.
https://varnish-cache.org/docs/7.4/reference/shell_tricks.html