1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
..
Copyright (c) 2021 Varnish Software AS
SPDX-License-Identifier: BSD-2-Clause
See LICENSE file for full text of license
.. _ref-shell_tricks:
%%%%%%%%%%%%
Shell Tricks
%%%%%%%%%%%%
All the varnish programs can be invoked with the single
argument ``--optstring`` to request their `getopt()`
specification, which simplifies wrapper scripts:
.. code-block:: text
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
|