[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Parsing options in the form "-C8"
From: |
irenezerafa |
Subject: |
Parsing options in the form "-C8" |
Date: |
Tue, 16 Nov 2021 20:27:15 +0000 |
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Tuesday, November 16th, 2021 at 8:15 PM, Dennis Williamson
<dennistwilliamson@gmail.com> wrote:
> On Tue, Nov 16, 2021, 1:28 PM irenezerafa via <help-bash@gnu.org> wrote:
>
>> I want to parse options in the following way "-C8", with the option being -C
>> and the value being `8`. What can
>> I do to implement the functionality?
>
> Bash does not have the features you're looking for. I'm not aware of a
> third-party utility to use with Bash that has them either (getopt is
> problematic),
You are right. I am doing the functionality myself using bash constructs
(string manipulations, conditionals, etc, ...)
> The Python core module called argparse does much of what you want and is rich
> with features and is easy to use, easy to extend and code to supplement its
> functionality (for example, to do unusual mutual exclusion) is easy to write.
> By far the most sensible thing to do if you are going to use Python to write
> your argument processor would be to write your whole program in Python. But
> it's conceivable that you could process your args in Python and write the
> rest of your program in Bash. But don't do that.
Could one run python things from the terminal. Another problem is that python
is too slow for me to use.
> Don't assemble an engine using a very good pair of pliers when a very good
> socket wrench is within a hand's reach.
- Parsing options in the form "-C8", (continued)
- Re: Parsing options in the form "-C8", Chet Ramey, 2021/11/16
- Re: Parsing options in the form "-C8", Chet Ramey, 2021/11/16
- Re: Parsing options in the form "-C8", Chris Elvidge, 2021/11/16
- Re: Parsing options in the form "-C8", Lawrence Velázquez, 2021/11/16
- Re: Parsing options in the form "-C8", Chet Ramey, 2021/11/16
Re: Parsing options in the form "-C8", Dennis Williamson, 2021/11/16