Is it possible to ignore unknown optional arguments with GNU getopt?
I have a script, scriptA.sh, that has optional arguments --optA, --optB, --optC, --optD
.
I would like to write a wrapper, wrapperA, with two optional arguments, --optX and --optY
, that calls scriptA
. However, I don't want to declare all optional parameters of scriptA inside the wrapper.
In particular, if inside wrapperA
, I specify optional arguments with
getopt --longoptions optX:,optY:
the call
wrapperA --optX --optA --optB
returns an error
getopt: unknown option -- optA
Can GNU getopt be forced to ignore unknown arguments and place them after the '--' in its output?