So I have a shell script that does some preparation and then runs a utility.
The preparation can be affected by switches like
-n. The contents of the command line that are not such switches are to be passed to the utility. Currently my script has:
while getopts ":an" opt; do
case $opt in
echo "Invalid option: -$OPTARG" >&2
However, this fails when I want to pass long-form options to the utiity, such as
--abc as that is interpreted as
c options by getopts.
So how can I process options in such a way that
-n is processed, but
--abc remains untouched? Unless, of course, I dump Shell and do it in Python – then options would be very easy, but I also need to copy files and run utilities, and Python makes this awkward.