Deutsch   English   Français   Italiano  
<vs4eja$14bph$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: Lawrence D'Oliveiro <ldo@nz.invalid>
Newsgroups: comp.os.linux.misc
Subject: Re: Useless Use Of Regexes
Date: Thu, 27 Mar 2025 21:05:46 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 51
Message-ID: <vs4eja$14bph$1@dont-email.me>
References: <vrsfkv$1md7d$1@dont-email.me> <vrsjva$1oouq$1@dont-email.me>
	<vrso4m$1toah$3@dont-email.me> <sm0o6xpqxwf.fsf@lakka.kapsi.fi>
	<vru632$lb7$1@news1.tnib.de> <vrvigv$gce5$3@dont-email.me>
	<vs09u6$61ff$1@news1.tnib.de> <vs1lgs$2f333$2@dont-email.me>
	<vs1ou7$9qn3$1@news1.tnib.de> <vs23sj$2s4s3$1@dont-email.me>
	<vs2suo$cka4$1@news1.tnib.de> <vs2ugt$3nl2p$1@dont-email.me>
	<vs3s5l$f45n$1@news1.tnib.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 27 Mar 2025 22:05:47 +0100 (CET)
Injection-Info: dont-email.me; posting-host="5e3725a960a956e95c3230978fe8baf9";
	logging-data="1191729"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18xUFh3cGxbxVotx/fVNmlo"
User-Agent: Pan/0.162 (Pokrosvk)
Cancel-Lock: sha1:qFjtIbT1dxVLlakZOm4LFGLe9x4=
Bytes: 3569

On Thu, 27 Mar 2025 16:51:16 +0100, Marc Haber wrote:

> Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
>
>>On Thu, 27 Mar 2025 07:58:32 +0100, Marc Haber wrote:
>>
>>> You could have it easier with getopt ...
>>
>>Last I checked, getopt doesn’t do long options.
> 
> You should check again.

ldo@theon:~> help getopt
getopts: getopts optstring name [arg ...]
    Parse option arguments.
    
    Getopts is used by shell procedures to parse positional parameters
    as options.
    
    OPTSTRING contains the option letters to be recognized; if a letter
    is followed by a colon, the option is expected to have an argument,
    which should be separated from it by white space.
    
    Each time it is invoked, getopts will place the next option in the
    shell variable $name, initializing name if it does not exist, and
    the index of the next argument to be processed into the shell
    variable OPTIND.  OPTIND is initialized to 1 each time the shell or
    a shell script is invoked.  When an option requires an argument,
    getopts places that argument into the shell variable OPTARG.
    
    getopts reports errors in one of two ways.  If the first character
    of OPTSTRING is a colon, getopts uses silent error reporting.  In
    this mode, no error messages are printed.  If an invalid option is
    seen, getopts places the option character found into OPTARG.  If a
    required argument is not found, getopts places a ':' into NAME and
    sets OPTARG to the option character found.  If getopts is not in
    silent mode, and an invalid option is seen, getopts places '?' into
    NAME and unsets OPTARG.  If a required argument is not found, a '?'
    is placed in NAME, OPTARG is unset, and a diagnostic message is
    printed.
    
    If the shell variable OPTERR has the value 0, getopts disables the
    printing of error messages, even if the first character of
    OPTSTRING is not a colon.  OPTERR has the value 1 by default.
    
    Getopts normally parses the positional parameters, but if arguments
    are supplied as ARG values, they are parsed instead.
    
    Exit Status:
    Returns success if an option is found; fails if the end of options is
    encountered or an error occurs.