ELGETOPT(1)

NAME
elgetopt - perform getopt-style parsing on the arguments to an execline script

SYNOPSIS
elgetopt [-D default] optstring prog...

DESCRIPTION
elgetopt expects to find a valid number n of arguments in the # environment variable, and n +1 environment variables 0, 1, ..., n. It exits 100 if it is not the case.

elgetopt pushes environment variables ( cf. execline-pushenv(7)) starting with ELGETOPT_. To get the previous values back, use ‘emptyenv -o’.

elgetopt looks into 1, 2, ... for options, as specified by optstring, which is a standard getopt(1) string.

If the -c switch is recognized, elgetopt sets the ELGETOPT_c environment variable. The value of that variable is the argument to the -c switch if it has one, and ‘1’ ( or default if given) otherwise.

After setting all recognized options, elgetopt makes new #, 1, 2, ... “positional parameters” with what remains.

elgetopt then execs into prog....

GNU-style options are not supported.

OPTIONS

-D default
    Use default as the value for the ELGETOPT_c environment variable if there is no argument to the -c switch. Default is ‘1’. The value is the same for all the options defined by elgetopt.

SEE ALSO
dollarat(1), getopt(1), shift(1), execline-pushenv(7)

This man page is ported from the authoritative documentation at: https://skarnet.org/software/execline/elgetopt.html

AUTHORS
Laurent Bercot Alexis <flexibeast@gmail.com> (man page port)