elgetopt - perform

ELGETOPT(1) BSD General Commands Manual ELGETOPT(1)


elgetopt — perform getopt(1)-style parsing on the arguments to an execline script


elgetopt optstring prog...


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 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.


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


Laurent Bercot
Alexis <

[email protected] > (man page port)

BSD February 14, 2021 BSD

Updated 2023-02-15 - jenkler.se | uex.se