Verify if a string has the format of a long option without argument. STRING is the string to validate. The optional VARNAME is the name of a variable that this function will set to the option name from STRING, without the leading dashes.
Return with code zero if the string is a long option without argument, else returns with code one.
An option must be of the form --option
, only characters in the ranges A-Z
, a-z
,
0-9
and the characters -
and _
are allowed in the option name.
Usage examples:
mbfl_getopts_islong --option ⇒ 0 mbfl_getopts_islong --option=123 ⇒ 1 mbfl_getopts_islong gasp ⇒ 1
Verify if a string has the format of a long option with argument. Arguments:
The string to validate.
Optional name of a variable that this function will set to the option name from STRING, without the leading dashes.
Optional name of a variable that this function will set to the option value from STRING.
Return with code 0
if the string is a long option with argument. Return with code 1
if the string is not an option with argument.
An option must be of the form --option=value
, only characters in the ranges A-Z
,
a-z
, 0-9
and the characters -
and _
are allowed in the option name.
If the argument is not an option with value, the variable names are ignored.
Usage examples:
mbfl_getopts_islong_with --option=one ⇒ 0 mbfl_getopts_islong_with --option ⇒ 1 mbfl_getopts_islong_with wappa ⇒ 1 mbfl_getopts_islong_with --option= ⇒ 1 mbfl_getopts_islong_with --= ⇒ 1
Verify if a string has the format of a brief option without argument. STRING is the string to validate. The optional VARNAME is the name of a variable that this function will set to the option name from STRING, without the leading dash.
Return with code zero if the argument is a brief option without argument, else return with code one.
A brief option must be of the form -a
, only characters in the ranges A-Z
, a-z
,
0-9
are allowed as option letters.
Usage examples:
mbfl_getopts_isbrief -o ⇒ 0 mbfl_getopts_isbrief -o123 ⇒ 1 mbfl_getopts_isbrief gasp ⇒ 1
Verify if a string has the format of a brief option with argument. Arguments:
The string to validate.
Optional name of a variable that this function will set to the option name from STRING, without the leading dashes.
Optional name of a variable that this function will set to the option value.
Return with code zero if the argument is a brief option without argument, else return with code one.
A brief option must be of the form -aV
(a
is the option, V
is the value), only
characters in the ranges A-Z
, a-z
, 0-9
are allowed as option letters.
Usage examples:
mbfl_getopts_isbrief_with -o123 ⇒ 0 mbfl_getopts_isbrief_with -o ⇒ 1 mbfl_getopts_isbrief_with --option ⇒ 1 mbfl_getopts_isbrief_with wappa ⇒ 1
This document describes version 3.0.0-devel.9 of Marcos Bash Functions Library.