• Useless Use Of Regexes

    From Lawrence D'Oliveiro@21:1/5 to All on Mon Mar 24 20:34:39 2025
    Besides the traditional “Useless Use Of Cat” (UUOC) newbie faux pas,
    we can add “Useless Use Of Regexes”.

    These can often be quite subtle. I spotted one obvious instance here <https://www.zdnet.com/article/5-ways-i-use-regex-in-linux-and-why-theyre-so-essential/>,
    namely this one:

    ip addr | grep -Eo '192\.168\.1\.[0-9]{1,3}'

    which can be more easily written using features built into iproute2 itself:

    ip addr show to 192.168.1.0/24

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Pancho@21:1/5 to Lawrence D'Oliveiro on Mon Mar 24 21:48:26 2025
    On 3/24/25 20:34, Lawrence D'Oliveiro wrote:
    Besides the traditional “Useless Use Of Cat” (UUOC) newbie faux pas,
    we can add “Useless Use Of Regexes”.

    These can often be quite subtle. I spotted one obvious instance here <https://www.zdnet.com/article/5-ways-i-use-regex-in-linux-and-why-theyre-so-essential/>,
    namely this one:

    ip addr | grep -Eo '192\.168\.1\.[0-9]{1,3}'



    Tut Tut!

    $ip addr | grep -E '192\.168\.0\.([0-1]?[0-9]?[0-9]?|2[0-4][0-9]|25[0-5])'

    Solve a problem with a RegEx, now you have two problems :-)


    which can be more easily written using features built into iproute2 itself:

    ip addr show to 192.168.1.0/24

    Seriously, though, it is often easier to filter output from a standard
    command with grep, than it is to learn all the command flags.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Pancho on Mon Mar 24 22:59:34 2025
    On Mon, 24 Mar 2025 21:48:26 +0000, Pancho wrote:

    On 3/24/25 20:34, Lawrence D'Oliveiro wrote:

    which can be more easily written using features built into iproute2
    itself:

    ip addr show to 192.168.1.0/24

    Seriously, though, it is often easier to filter output from a standard command with grep, than it is to learn all the command flags.

    Don’t forget the option of JSON-format output, for even easier processing
    in scripts than messing around with regexes.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From The Natural Philosopher@21:1/5 to Pancho on Mon Mar 24 22:57:07 2025
    On 24/03/2025 21:48, Pancho wrote:
    Solve a problem with a RegEx, now you have two problems 🙂
    +1 LOL

    --
    To ban Christmas, simply give turkeys the vote.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marc Haber@21:1/5 to Lawrence D'Oliveiro on Tue Mar 25 08:30:56 2025
    Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
    On Mon, 24 Mar 2025 21:48:26 +0000, Pancho wrote:

    On 3/24/25 20:34, Lawrence D'Oliveiro wrote:

    which can be more easily written using features built into iproute2
    itself:

    ip addr show to 192.168.1.0/24

    Seriously, though, it is often easier to filter output from a standard
    command with grep, than it is to learn all the command flags.

    Don’t forget the option of JSON-format output, for even easier processing >in scripts than messing around with regexes.

    I'd prefer a regexp over jq any time. But that's probably wrong.

    N.B.: ip addr --oneline

    Greetings
    Marc
    --
    ---------------------------------------------------------------------------- Marc Haber | " Questions are the | Mailadresse im Header Rhein-Neckar, DE | Beginning of Wisdom " |
    Nordisch by Nature | Lt. Worf, TNG "Rightful Heir" | Fon: *49 6224 1600402

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anssi Saari@21:1/5 to Lawrence D'Oliveiro on Tue Mar 25 11:09:52 2025
    Lawrence D'Oliveiro <ldo@nz.invalid> writes:

    Don’t forget the option of JSON-format output, for even easier processing in scripts than messing around with regexes.

    Kinda yes, but for a script I'd really like to just get the data
    directly in an associative array that I can use as is. Instead of
    messing around with jq. I just took a look around in Stack Exchange but
    meh. One simplish bash example was this:

    typeset -A myarray

    while IFS== read -r key value; do
    myarray["$key"]="$value"
    done < <(jq -r '.SITE_DATA | to_entries | .[] | .key + "=" + .value ' file.json)

    But that still pukes if the data happens to have a numeric value and in
    ip route output at least the metric value is numeric. So apparently it
    needs to become .key + "=" + (.value|tostring) to handle that.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marc Haber@21:1/5 to Anssi Saari on Tue Mar 25 13:03:45 2025
    Anssi Saari <anssi.saari@usenet.mail.kapsi.fi> wrote:
    Lawrence D'Oliveiro <ldo@nz.invalid> writes:

    Don’t forget the option of JSON-format output, for even easier processing >> in scripts than messing around with regexes.

    Kinda yes, but for a script I'd really like to just get the data
    directly in an associative array that I can use as is. Instead of
    messing around with jq. I just took a look around in Stack Exchange but
    meh. One simplish bash example was this:

    typeset -A myarray

    while IFS== read -r key value; do
    myarray["$key"]="$value"
    done < <(jq -r '.SITE_DATA | to_entries | .[] | .key + "=" + .value ' file.json)

    But that still pukes if the data happens to have a numeric value and in
    ip route output at least the metric value is numeric. So apparently it
    needs to become .key + "=" + (.value|tostring) to handle that.

    This is a classic example why shellscripts are inferior. If you had
    written that in python, you could just ingest iproute's output in a
    python data structire and access it naturally.

    A very wise German person, today a friend of mine, used to say 25
    years ago: "Verwende perl. Shell will man können, dann aber nicht
    verwenden." In English that would be "Use Perl. You want to be able to
    use Shell, but then don't use it." Today, of course, that would be
    python.

    Greetings
    Marc
    --
    ---------------------------------------------------------------------------- Marc Haber | " Questions are the | Mailadresse im Header Rhein-Neckar, DE | Beginning of Wisdom " |
    Nordisch by Nature | Lt. Worf, TNG "Rightful Heir" | Fon: *49 6224 1600402

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Pancho@21:1/5 to Lawrence D'Oliveiro on Tue Mar 25 12:08:36 2025
    On 3/24/25 22:59, Lawrence D'Oliveiro wrote:
    On Mon, 24 Mar 2025 21:48:26 +0000, Pancho wrote:

    On 3/24/25 20:34, Lawrence D'Oliveiro wrote:

    which can be more easily written using features built into iproute2
    itself:

    ip addr show to 192.168.1.0/24

    Seriously, though, it is often easier to filter output from a standard
    command with grep, than it is to learn all the command flags.

    Don’t forget the option of JSON-format output, for even easier processing in scripts than messing around with regexes.

    Forget? That presumes I ever knew. Well maybe I did, nowadays, I forget
    what I have forgotten.

    Anyway, JSON output looks cool. However, it doesn't seem to be common
    for other commands.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ben Collver@21:1/5 to Lawrence D'Oliveiro on Tue Mar 25 15:29:16 2025
    On 2025-03-24, Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
    namely this one:

    ip addr | grep -Eo '192\.168\.1\.[0-9]{1,3}'

    which can be more easily written using features built into iproute2 itself:

    ip addr show to 192.168.1.0/24

    Even if you were going to use regex for that, since the mask is /24,
    why not shorten it?

    OLD: ip addr | grep -Eo '192\.168\.1\.[0-9]{1,3}'
    NEW: ip addr | grep -Eo '192\.168\.1\.'

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Marc Haber on Wed Mar 26 00:35:10 2025
    On Tue, 25 Mar 2025 08:30:56 +0100, Marc Haber wrote:

    I'd prefer a regexp over jq any time. But that's probably wrong.

    I’ll use whatever’s available. The first thing to do is look for
    options to customize the output, to reduce or even eliminate the need
    to pull bits out with regexes or other complex parsing.

    Example of how not to do things: <https://arstechnica.com/gadgets/2021/09/command-line-wizardry-part-two-variables-and-loops-in-bash/>

    N.B.: ip addr --oneline

    root@theon:~ # ip addr --oneline
    Command "--oneline" is unknown, try "ip address help".
    root@theon:~ # ip addr show --oneline
    Device "--oneline" does not exist.
    root@theon:~ # ip --oneline addr show
    [got it]

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Marc Haber on Wed Mar 26 00:42:08 2025
    On Tue, 25 Mar 2025 13:03:45 +0100, Marc Haber wrote:

    This is a classic example why shellscripts are inferior. If you had
    written that in python, you could just ingest iproute's output in a
    python data structire and access it naturally.

    A very wise German person, today a friend of mine, used to say 25
    years ago: "Verwende perl. Shell will man können, dann aber nicht verwenden." In English that would be "Use Perl. You want to be able
    to use Shell, but then don't use it." Today, of course, that would
    be python.

    There is a certain challenge in seeing how far you can push things in
    a shell script (or specifically, a bash script), before giving up and
    switching to Python. For example, figuring out how to deal with
    arbitrary file names, which might include funny characters like spaces
    and newlines -- can that be done in bash? Yes it can. But maybe it’s
    more trouble than it’s worth ...

    My classic example of a large, yet well-written shell script is the
    configure script for FFmpeg <https://git.videolan.org/?p=ffmpeg.git;a=tree;h=refs/heads/master;hb=refs/heads/master>.
    It’s over 8000 lines. Obviously it must be handwritten, not generated
    by GNU Autotools in the traditional way, because you can actually read
    it and understand what it does.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From c186282@21:1/5 to Marc Haber on Wed Mar 26 00:47:11 2025
    On 3/25/25 8:03 AM, Marc Haber wrote:
    Anssi Saari <anssi.saari@usenet.mail.kapsi.fi> wrote:
    Lawrence D'Oliveiro <ldo@nz.invalid> writes:

    Don’t forget the option of JSON-format output, for even easier processing >>> in scripts than messing around with regexes.

    Kinda yes, but for a script I'd really like to just get the data
    directly in an associative array that I can use as is. Instead of
    messing around with jq. I just took a look around in Stack Exchange but
    meh. One simplish bash example was this:

    typeset -A myarray

    while IFS== read -r key value; do
    myarray["$key"]="$value"
    done < <(jq -r '.SITE_DATA | to_entries | .[] | .key + "=" + .value ' file.json)

    But that still pukes if the data happens to have a numeric value and in
    ip route output at least the metric value is numeric. So apparently it
    needs to become .key + "=" + (.value|tostring) to handle that.

    This is a classic example why shellscripts are inferior. If you had
    written that in python, you could just ingest iproute's output in a
    python data structire and access it naturally.

    A very wise German person, today a friend of mine, used to say 25
    years ago: "Verwende perl. Shell will man können, dann aber nicht verwenden." In English that would be "Use Perl. You want to be able to
    use Shell, but then don't use it." Today, of course, that would be
    python.

    ANYthing but Perl !!! :-)

    Ok, except maybe Lisp ......

    It is popular to hate Python these days. Not sure
    why except that it's popular/common and, horrors !,
    even the NEWBIES can use it.

    I do still write bash scripts, IF the job is kinda
    simple and straight-forward. However getting 'fancy'
    stuff done in scripts soon becomes anything but
    transparent ... too many squiggles and punctuation
    chars in EXACTLY the right places - a lang extended
    and extended and extended kinda ad-hoc until it's
    easy to get an unreadable mess. Python is much
    easier and more self-documenting. These days it's
    even fairly fast. TONS of libraries and examples
    out there too.

    Today had to make a few mods to a 450-line Python
    pgm I wrote about three years ago. Was NOT hard,
    could follow what I'd writ before. That's not
    always the case with 'C' fer sure :-)

    Anyway, generally proto everything in Python these
    days, fool around with everything because it's
    easy, and then if appropriate port it over to 'C'
    or Pascal (still love Pascal !).

    Hmmm ... one of the things that attracted me to
    the Unix side long long ago was the 'C-shell' ...
    yet for some reason I never DID anything with it.
    Perhaps time for a second look .....

    As for regex ... avoid whenever possible. WORSE
    syntax than Bash - gobbeldegoop. More plain to
    write a few easy lines of Python for the same
    effect ........

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marc Haber@21:1/5 to Lawrence D'Oliveiro on Wed Mar 26 08:21:42 2025
    Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
    There is a certain challenge in seeing how far you can push things in
    a shell script (or specifically, a bash script), before giving up and >switching to Python.

    I give up way too late in that. It has become better since I usually
    start off with ChatGPT which takes care of the boilerplate stuff. The
    real work usually needs real intelligence though.

    Greetings
    Marc
    --
    ---------------------------------------------------------------------------- Marc Haber | " Questions are the | Mailadresse im Header Rhein-Neckar, DE | Beginning of Wisdom " |
    Nordisch by Nature | Lt. Worf, TNG "Rightful Heir" | Fon: *49 6224 1600402

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marc Haber@21:1/5 to Lawrence D'Oliveiro on Wed Mar 26 08:20:28 2025
    Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
    On Tue, 25 Mar 2025 08:30:56 +0100, Marc Haber wrote:
    N.B.: ip addr --oneline

    root@theon:~ # ip addr --oneline
    Command "--oneline" is unknown, try "ip address help".
    root@theon:~ # ip addr show --oneline
    Device "--oneline" does not exist.
    root@theon:~ # ip --oneline addr show
    [got it]

    I get that wrong ever single time but this time I was probably
    motivating you to investigate deeper which makes sure that you'll
    remember.

    Greetings
    Marc
    --
    ---------------------------------------------------------------------------- Marc Haber | " Questions are the | Mailadresse im Header Rhein-Neckar, DE | Beginning of Wisdom " |
    Nordisch by Nature | Lt. Worf, TNG "Rightful Heir" | Fon: *49 6224 1600402

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From rbowman@21:1/5 to All on Wed Mar 26 16:51:04 2025
    On Wed, 26 Mar 2025 00:47:11 -0400, c186282 wrote:

    Hmmm ... one of the things that attracted me to the Unix side long
    long ago was the 'C-shell' ...
    yet for some reason I never DID anything with it.
    Perhaps time for a second look .....

    I used tcsh for years and even had a Windows version. I switched to bash reluctantly when it became the default on most Linux distros. It was
    annoying since I had a number of aliases that had to be rewritten as
    functions in .bashrc. I saw that more as a bug than a feature.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Marc Haber on Wed Mar 26 19:45:32 2025
    On Wed, 26 Mar 2025 08:21:42 +0100, Marc Haber wrote:

    It has become better since I usually start off with ChatGPT which
    takes care of the boilerplate stuff.

    The main point of using a very-high-level language (like bash) is that you shouldn’t need any boilerplate stuff.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marc Haber@21:1/5 to Lawrence D'Oliveiro on Wed Mar 26 21:43:51 2025
    Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
    On Wed, 26 Mar 2025 08:21:42 +0100, Marc Haber wrote:
    It has become better since I usually start off with ChatGPT which
    takes care of the boilerplate stuff.

    The main point of using a very-high-level language (like bash) is that you >shouldn’t need any boilerplate stuff.

    As soon as you make it flexlbie, with command line options, you begin
    typing getopt or GetOptions stuff and that's pretty much boilerplate.

    Greetings
    Marc
    --
    ---------------------------------------------------------------------------- Marc Haber | " Questions are the | Mailadresse im Header Rhein-Neckar, DE | Beginning of Wisdom " |
    Nordisch by Nature | Lt. Worf, TNG "Rightful Heir" | Fon: *49 6224 1600402

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Marc Haber on Wed Mar 26 23:50:43 2025
    On Wed, 26 Mar 2025 21:43:51 +0100, Marc Haber wrote:

    Lawrence D'Oliveiro <ldo@nz.invalid> wrote:

    On Wed, 26 Mar 2025 08:21:42 +0100, Marc Haber wrote:
    It has become better since I usually start off with ChatGPT which
    takes care of the boilerplate stuff.

    The main point of using a very-high-level language (like bash) is that
    you shouldn’t need any boilerplate stuff.

    As soon as you make it flexlbie, with command line options, you begin
    typing getopt or GetOptions stuff and that's pretty much boilerplate.

    Well, I do do that. Mainly it’s just a loop, though, e.g.

    for ((;;)); do
    if [ "${1:0:2}" != "--" ]; then
    break
    fi
    if [ "$1" == "--" ]; then
    shift
    break
    fi
    opt="${1:2:${#1}}"
    shift
    val="${opt#*=}"
    if [ "$val" = "$opt" ]; then
    val=""
    fi
    opt="${opt%%=*}"
    if [ "$opt" = "animation" ]; then
    animation=1
    elif [ "$opt" = "blender" ]; then
    blender="$val"
    elif [ "$opt" = "camera" ]; then
    camera="$val"
    elif [ "$opt" = "collections" ]; then
    collections="$val"
    elif [ "$opt" = "crash-protect" ]; then
    crash_protect=1
    elif [ "$opt" = "crash-retry-count" ]; then
    crash_retry_count="$val"
    elif [ "$opt" = "digits" ]; then
    digits="$val"
    ...
    else
    opterror "bad option $opt"
    fi
    done

    I would say, only a few lines in there count as “boilerplate” ...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marc Haber@21:1/5 to Lawrence D'Oliveiro on Thu Mar 27 07:58:32 2025
    Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
    On Wed, 26 Mar 2025 21:43:51 +0100, Marc Haber wrote:

    Lawrence D'Oliveiro <ldo@nz.invalid> wrote:

    On Wed, 26 Mar 2025 08:21:42 +0100, Marc Haber wrote:
    It has become better since I usually start off with ChatGPT which
    takes care of the boilerplate stuff.

    The main point of using a very-high-level language (like bash) is that >>>you shouldn’t need any boilerplate stuff.

    As soon as you make it flexlbie, with command line options, you begin
    typing getopt or GetOptions stuff and that's pretty much boilerplate.

    Well, I do do that. Mainly it’s just a loop, though, e.g.

    for ((;;)); do
    if [ "${1:0:2}" != "--" ]; then
    break
    fi
    if [ "$1" == "--" ]; then
    shift
    break
    fi
    opt="${1:2:${#1}}"
    shift
    val="${opt#*=}"
    if [ "$val" = "$opt" ]; then
    val=""
    fi
    opt="${opt%%=*}"
    if [ "$opt" = "animation" ]; then
    animation=1
    elif [ "$opt" = "blender" ]; then
    blender="$val"
    elif [ "$opt" = "camera" ]; then
    camera="$val"
    elif [ "$opt" = "collections" ]; then
    collections="$val"
    elif [ "$opt" = "crash-protect" ]; then
    crash_protect=1
    elif [ "$opt" = "crash-retry-count" ]; then
    crash_retry_count="$val"
    elif [ "$opt" = "digits" ]; then
    digits="$val"
    ...
    else
    opterror "bad option $opt"
    fi
    done

    I would say, only a few lines in there count as “boilerplate” ...

    All of them. You could have it easier with getopt, but oh my.

    Greetings
    Marc
    --
    ---------------------------------------------------------------------------- Marc Haber | " Questions are the | Mailadresse im Header Rhein-Neckar, DE | Beginning of Wisdom " |
    Nordisch by Nature | Lt. Worf, TNG "Rightful Heir" | Fon: *49 6224 1600402

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From c186282@21:1/5 to rbowman on Thu Mar 27 03:13:24 2025
    On 3/26/25 12:51 PM, rbowman wrote:
    On Wed, 26 Mar 2025 00:47:11 -0400, c186282 wrote:

    Hmmm ... one of the things that attracted me to the Unix side long
    long ago was the 'C-shell' ...
    yet for some reason I never DID anything with it.
    Perhaps time for a second look .....

    I used tcsh for years and even had a Windows version. I switched to bash reluctantly when it became the default on most Linux distros. It was
    annoying since I had a number of aliases that had to be rewritten as functions in .bashrc. I saw that more as a bug than a feature.

    Well, they were never made to be "the same" ....

    LOOKED for good stuff oh csh/tcsh yesterday and
    surprisingly not MUCH useful stuff/examples to
    be found - at least in the first page or two of
    search results. As such I'd say it's become rather
    "unpopular" ... though not necessarily bad or
    incapable.

    A much more 'C-ish' shell DOES appeal to me. DID
    also come across a utility that proports to turn
    Bash scrips INTO executable 'C' ... gotta fool
    with that for awhile. However initially writing
    in something more like 'C' is where the appeal
    lies.

    Found, ran, a few simple csh examples ... all
    good. But, gotta see how to EXPAND those.

    TODAY'S job ... wanna move my existing MX install
    on a BMax unit to my newer BeeLink N150 unit so
    I can use the extra CPU to combine two boxes
    into one. Now, HOW does fuckin' WORM set static
    IP addresses ..... I posted on that a year or so
    ago .......... they should have stuck to /etc/
    networking like all the historical examples ....

    MX does include a 'clone' utility - sparse
    backup that will produce an installable ISO.

    I've used it before and it WORKS. That's my
    path - minimal work afterwards. N95 Gen 12 to
    N150 Gen-13 should give the extra oomph to
    combine what I've needed two N95 boxes to do.

    New board still has 16gb, but a 1tb M.2 SSD
    for under $200us. Figured I'd better buy NOW
    as the Trump tariffs are gonna screw things
    up pretty bad for awhile.

    The old N95s ... I'll think of something ...
    wanted to add a few more security cams/sensors
    in out-buildings ....... 'Motion', note recent
    config revisions ... does just great at
    turning cam snapshots into handy mjpeg streams.

    Just, for PRIDE, gotta make sure the included
    Winders on new box doesn't run for a microsecond :-)

    Um ... may be wrong ... but it seems BeeLink
    includes FOUR USB3 ports but BMax only TWO.

    Just for info, don't know if anyone cares, finding
    small IR-capable USB cams is a PAIN IN THE ASS these
    days. Was working off a small stock of 'Spinel' units -
    in a very small thin minimalist box with threads
    for M12 lenses. Now they stopped making those.

    "ArduCams" sold on Amazon LOOK kinda the same,
    but the motherfuckers stick an IR filter right
    on the sensor chip ! Managed to tease two of
    those off - but ruined the 3rd cam. Even finding
    IR unfiltered lenses is a trial - SOMETIMES can
    break off the filter, sometimes not. Why the hell
    do they DO that ???

    If you don't want IR there's NO issue finding
    filtered lenses ! I've got a old fairly big
    property and have IR floods to illuminate - 250'
    to road/mailbox. DO have a couple of 600 series
    HP webcams I destroyed, glued M12 sockets to,
    good for IR now and you can even get audio. Newer
    models have the damned IR filter glued-on. 'Real'
    canned IP cams ARE fairly cheap now - some under
    $100usd. 1080p is good enough. However they're
    just not as FUN as do-it-yourself.

    So interesting ... in IR spectrum ... black
    clothing oft looks red, even white ... the
    dyes are intended for human-spectrum only.
    Have ONE cam with a 1500nm filter, deeper IR.
    Things look even more interesting.

    Oh well, I've rambled on .........

    Party on dude !

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From c186282@21:1/5 to Lawrence D'Oliveiro on Thu Mar 27 04:08:17 2025
    On 3/26/25 3:45 PM, Lawrence D'Oliveiro wrote:
    On Wed, 26 Mar 2025 08:21:42 +0100, Marc Haber wrote:

    It has become better since I usually start off with ChatGPT which
    takes care of the boilerplate stuff.

    The main point of using a very-high-level language (like bash) is that you shouldn’t need any boilerplate stuff.

    Bash is "high-level" ??? :-)

    Could write a near-clone in 'C' in a few lazy days.
    Gimme a week, ASM.

    Depends on defs I guess.

    As for "Chat" and friends ... just don't see myself
    EVER using them. Writing the 'boilerplate' is all part
    of the challenge, the FUN. 'AI' may have its weird
    little ideas, but to date humans can be much more
    creative.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Marc Haber on Thu Mar 27 07:25:17 2025
    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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marc Haber@21:1/5 to Lawrence D'Oliveiro on Thu Mar 27 16:51:16 2025
    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.

    --
    ---------------------------------------------------------------------------- Marc Haber | " Questions are the | Mailadresse im Header Rhein-Neckar, DE | Beginning of Wisdom " |
    Nordisch by Nature | Lt. Worf, TNG "Rightful Heir" | Fon: *49 6224 1600402

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Marc Haber on Thu Mar 27 21:05:46 2025
    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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From marrgol@21:1/5 to All on Fri Mar 28 12:21:20 2025
    On 2025-03-27 at 22:05 Lawrence D'Oliveiro 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 ...]
    […]

    You're quoting help to 'getopts' shell built-in command --
    you are mistaking it for 'getopt' program from util-linux.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Chris Ahlstrom@21:1/5 to marrgol on Fri Mar 28 11:42:37 2025
    marrgol wrote this post while blinking in Morse code:

    On 2025-03-27 at 22:05 Lawrence D'Oliveiro 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 ...]
    […]

    You're quoting help to 'getopts' shell built-in command --
    you are mistaking it for 'getopt' program from util-linux.

    $ man getopt_long
    getopt(3) Library Functions Manual getopt(3)

    NAME
    getopt, getopt_long, getopt_long_only, optarg, optind, opterr, optopt -
    Parse command-line options

    The getopt family is a pain in the ass. I wrote my own command-line parsing, though I do not use it in legacy apps.

    --
    Overcoming

    Water overcomes the stone;
    Without substance it requires no opening;
    This is the benefit of taking no action.
    Yet benefit without action,
    And experience without abstraction,
    Are practiced by very few.
    -- Lao Tse, "Tao Te Ching"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From rbowman@21:1/5 to Chris Ahlstrom on Fri Mar 28 18:46:46 2025
    On Fri, 28 Mar 2025 11:42:37 -0400, Chris Ahlstrom wrote:

    The getopt family is a pain in the ass. I wrote my own command-line
    parsing,
    though I do not use it in legacy apps.

    I've never used getopt_long() but I find getopt() to be cleaner than DIY parsing.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to marrgol on Fri Mar 28 20:25:19 2025
    On Fri, 28 Mar 2025 12:21:20 +0100, marrgol wrote:

    On 2025-03-27 at 22:05 Lawrence D'Oliveiro wrote:

    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 ...]
    […]

    You're quoting help to 'getopts' shell built-in command --
    you are mistaking it for 'getopt' program from util-linux.

    I had a look at that, too. Here’s an extract from the example script /usr/share/doc/util-linux/examples/getopt-example.bash demonstrating
    the use of the getopt(1) command from util-linux:

    ----
    TEMP=$(getopt -o 'ab:c::' --long 'a-long,b-long:,c-long::' -n 'example.bash' -- "$@")

    if [ $? -ne 0 ]; then
    echo 'Terminating...' >&2
    exit 1
    fi

    # Note the quotes around "$TEMP": they are essential!
    eval set -- "$TEMP"
    unset TEMP

    while true; do
    case "$1" in
    '-a'|'--a-long')
    echo 'Option a'
    shift
    continue
    ;;
    '-b'|'--b-long')
    echo "Option b, argument '$2'"
    shift 2
    continue
    ;;
    '-c'|'--c-long')
    # c has an optional argument. As we are in quoted mode,
    # an empty parameter will be generated if its optional
    # argument is not found.
    case "$2" in
    '')
    echo 'Option c, no argument'
    ;;
    *)
    echo "Option c, argument '$2'"
    ;;
    esac
    shift 2
    continue
    ;;
    '--')
    shift
    break
    ;;
    *)
    echo 'Internal error!' >&2
    exit 1
    ;;
    esac
    done
    ----

    Doesn’t seem to me that’s saving much effort. Does it look like a
    saving of effort to you?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Chris Ahlstrom@21:1/5 to rbowman on Sat Mar 29 11:40:49 2025
    rbowman wrote this post while blinking in Morse code:

    On Fri, 28 Mar 2025 11:42:37 -0400, Chris Ahlstrom wrote:

    The getopt family is a pain in the ass. I wrote my own command-line
    parsing,
    though I do not use it in legacy apps.

    I've never used getopt_long() but I find getopt() to be cleaner than DIY parsing.

    My parser accepts an array of option structures specifying the long name, the character code (if any), the type of data represented by the option, enabling/disabling of options, the default value, the current value,
    a dirty flag, and a description. It generates color-coded help. It has
    common built-in options for help and verbosity, for example. And of
    course a number of test apps.

    Options can be grouped into sections suitable for read/write from an INI-style file, complete with descriptions of each section.

    It's written in C++, but with a C interface also provided.

    During my recent wrestling with getopt_long(), I noticed a couple other features to cover.

    I'm not claiming anyone other than I will ever want to use it :-)

    --
    The departing division general manager met a last time with his young
    successor and gave him three envelopes. "My predecessor did this for me,
    and I'll pass the tradition along to you," he said. "At the first sign
    of trouble, open the first envelope. Any further difficulties, open the
    second envelope. Then, if problems continue, open the third envelope.
    Good luck." The new manager returned to his office and tossed the envelopes into a drawer.
    Six months later, costs soared and earnings plummeted. Shaken, the young man opened the first envelope, which said, "Blame it all on me."
    The next day, he held a press conference and did just that. The
    crisis passed.
    Six months later, sales dropped precipitously. The beleaguered
    manager opened the second envelope. It said, "Reorganize."
    He held another press conference, announcing that the division
    would be restructured. The crisis passed.
    A year later, everything went wrong at once and the manager was
    blamed for all of it. The harried executive closed his office door, sank
    into his chair, and opened the third envelope.
    "Prepare three envelopes..." it said.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?St=C3=A9phane?= CARPENTIE@21:1/5 to All on Sun Mar 30 22:04:45 2025
    Le 30-03-2025, Lawrence D'Oliveiro <ldo@nz.invalid> a écrit :
    On 30 Mar 2025 14:02:51 GMT, Stéphane CARPENTIER wrote:

    The UUOC is more a claim made by FR/DG/LP/whatever and the like than a
    really newbie issue. It's a good and easy way to look at what you do
    before removing the cat and redirecting the output to another program.

    You can look at the output without a cat.

    Yes, with the right option and/or with the right modification of the
    command line. But it's easier and faster to just add a cat than to find
    the "right" way to do it.

    That’s the whole point about it being useless.

    On a modern computer, the time taken to avoid using cat is far more
    important than the time taken by the computer to provide the result. So,
    if you want a fast result, you don't care about UUOC and you just add a
    cat when you want. It's the whole point about stopping the pedantic
    speaking about UUOC. Because it's not useless: it provides an easy and
    fast way to get what you want.

    --
    Si vous avez du temps à perdre :
    https://scarpet42.gitlab.io

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?St=C3=A9phane?= CARPENTIE@21:1/5 to All on Sun Mar 30 14:04:26 2025
    Le 24-03-2025, Pancho <Pancho.Jones@protonmail.com> a écrit :

    Seriously, though, it is often easier to filter output from a standard command with grep, than it is to learn all the command flags.

    Yes, mostly when you want to find something by creating your request
    depending on its results.

    --
    Si vous avez du temps à perdre :
    https://scarpet42.gitlab.io

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?St=C3=A9phane?= CARPENTIE@21:1/5 to All on Sun Mar 30 14:02:51 2025
    Le 24-03-2025, Lawrence D'Oliveiro <ldo@nz.invalid> a écrit :
    Besides the traditional “Useless Use Of Cat” (UUOC) newbie faux pas,

    The UUOC is more a claim made by FR/DG/LP/whatever and the like than a
    really newbie issue. It's a good and easy way to look at what you do
    before removing the cat and redirecting the output to another program.

    --
    Si vous avez du temps à perdre :
    https://scarpet42.gitlab.io

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Wayne@21:1/5 to Lawrence D'Oliveiro on Mon Mar 31 23:54:51 2025
    On 3/27/2025 5:05 PM, Lawrence D'Oliveiro wrote:
    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.
    ...

    Note that getopt is different from getopts!

    --
    Wayne

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to All on Mon Mar 31 01:26:40 2025
    On 30 Mar 2025 22:04:45 GMT, Stéphane CARPENTIER wrote:

    Yes, with the right option and/or with the right modification of the
    command line. But it's easier and faster to just add a cat than to find
    the "right" way to do it.

    Give an example.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to All on Sun Mar 30 21:15:42 2025
    On 30 Mar 2025 14:02:51 GMT, Stéphane CARPENTIER wrote:

    The UUOC is more a claim made by FR/DG/LP/whatever and the like than a
    really newbie issue. It's a good and easy way to look at what you do
    before removing the cat and redirecting the output to another program.

    You can look at the output without a cat. That’s the whole point about it being useless.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?St=C3=A9phane?= CARPENTIE@21:1/5 to All on Sun Apr 6 08:40:54 2025
    Le 31-03-2025, Lawrence D'Oliveiro <ldo@nz.invalid> a écrit :
    On 30 Mar 2025 22:04:45 GMT, Stéphane CARPENTIER wrote:

    Yes, with the right option and/or with the right modification of the
    command line. But it's easier and faster to just add a cat than to find
    the "right" way to do it.

    Give an example.

    A lot of time I run cat to find some information in a file. And when the
    file is bigger than expected, I'll just grep its output. Of course,
    it's better to directly grep the file, but it's easier and faster to add
    a grep at the end of the previous command than to either write directly
    the right command or to go at the beginning of the line to remove the
    cat and put grep instead. Mostly when the name of the file is long in a
    far remote directory.

    --
    Si vous avez du temps à perdre :
    https://scarpet42.gitlab.io

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to All on Mon Apr 7 21:39:58 2025
    On 06 Apr 2025 08:40:54 GMT, Stéphane CARPENTIER wrote:

    Le 31-03-2025, Lawrence D'Oliveiro <ldo@nz.invalid> a écrit :

    On 30 Mar 2025 22:04:45 GMT, Stéphane CARPENTIER wrote:

    Yes, with the right option and/or with the right modification of the
    command line. But it's easier and faster to just add a cat than to
    find the "right" way to do it.

    Give an example.

    A lot of time I run cat to find some information in a file. And when the
    file is bigger than expected, I'll just grep its output. Of course,
    it's better to directly grep the file, but it's easier and faster to add
    a grep at the end of the previous command than to either write directly
    the right command or to go at the beginning of the line to remove the
    cat and put grep instead. Mostly when the name of the file is long in a
    far remote directory.

    You do have command-line editing enabled, right? You just press the HOME
    key (or CTRL/A) to go to the start of the line.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From c186282@21:1/5 to Lawrence D'Oliveiro on Mon Apr 7 21:00:03 2025
    On 4/7/25 5:39 PM, Lawrence D'Oliveiro wrote:
    On 06 Apr 2025 08:40:54 GMT, Stéphane CARPENTIER wrote:

    Le 31-03-2025, Lawrence D'Oliveiro <ldo@nz.invalid> a écrit :

    On 30 Mar 2025 22:04:45 GMT, Stéphane CARPENTIER wrote:

    Yes, with the right option and/or with the right modification of the
    command line. But it's easier and faster to just add a cat than to
    find the "right" way to do it.

    Give an example.

    A lot of time I run cat to find some information in a file. And when the
    file is bigger than expected, I'll just grep its output. Of course,
    it's better to directly grep the file, but it's easier and faster to add
    a grep at the end of the previous command than to either write directly
    the right command or to go at the beginning of the line to remove the
    cat and put grep instead. Mostly when the name of the file is long in a
    far remote directory.

    You do have command-line editing enabled, right? You just press the HOME
    key (or CTRL/A) to go to the start of the line.


    That works OK. However 'grep' tends to be THE most
    valuable utility for finding what you want in a
    vast sea of files.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Eli the Bearded@21:1/5 to ldo@nz.invalid on Tue Apr 8 02:05:04 2025
    In comp.os.linux.misc, Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
    On 06 Apr 2025 08:40:54 GMT, Stéphane CARPENTIER wrote:
    A lot of time I run cat to find some information in a file. And when the
    file is bigger than expected, I'll just grep its output. Of course,
    it's better to directly grep the file, but it's easier and faster to add
    a grep at the end of the previous command than to either write directly
    the right command or to go at the beginning of the line to remove the
    cat and put grep instead. Mostly when the name of the file is long in a
    far remote directory.
    You do have command-line editing enabled, right? You just press the HOME
    key (or CTRL/A) to go to the start of the line.

    Very presumptious to assume emacs style line editing, isn't it?

    To go back in history, I type <ESC>k and then I'm at the start of the
    line of the most recent command. On the current line I'd type <ESC>^
    but <ESC><HOME> would work.

    But really, I don't think it is proper to care about inefficent use of
    commands at the command line. Go ahead and judge in a script or
    documentation (or an example posted to Usenet), but what people do in
    the privacy of their own shell is their business.

    Elijah
    ------
    uses <HOME>/<END> pretty much exclusively in GUI tools like browsers

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From c186282@21:1/5 to Eli the Bearded on Mon Apr 7 22:06:23 2025
    On 4/7/25 10:05 PM, Eli the Bearded wrote:
    In comp.os.linux.misc, Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
    On 06 Apr 2025 08:40:54 GMT, Stéphane CARPENTIER wrote:
    A lot of time I run cat to find some information in a file. And when the >>> file is bigger than expected, I'll just grep its output. Of course,
    it's better to directly grep the file, but it's easier and faster to add >>> a grep at the end of the previous command than to either write directly
    the right command or to go at the beginning of the line to remove the
    cat and put grep instead. Mostly when the name of the file is long in a
    far remote directory.
    You do have command-line editing enabled, right? You just press the HOME
    key (or CTRL/A) to go to the start of the line.

    Very presumptious to assume emacs style line editing, isn't it?

    To go back in history, I type <ESC>k and then I'm at the start of the
    line of the most recent command. On the current line I'd type <ESC>^
    but <ESC><HOME> would work.

    But really, I don't think it is proper to care about inefficent use of commands at the command line. Go ahead and judge in a script or
    documentation (or an example posted to Usenet), but what people do in
    the privacy of their own shell is their business.

    Just use nano ....

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Eli the Bearded on Tue Apr 8 05:49:03 2025
    On Tue, 8 Apr 2025 02:05:04 -0000 (UTC), Eli the Bearded wrote:

    Very presumptious to assume emacs style line editing, isn't it?

    That is the usual default.

    But really, I don't think it is proper to care about inefficent use of commands at the command line.

    Don’t, then.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anssi Saari@21:1/5 to Eli the Bearded on Tue Apr 8 15:39:47 2025
    Eli the Bearded <*@eli.users.panix.com> writes:

    Very presumptious to assume emacs style line editing, isn't it?

    To go back in history, I type <ESC>k and then I'm at the start of the
    line of the most recent command. On the current line I'd type <ESC>^
    but <ESC><HOME> would work.

    The only time I've had to use vi command history editing was with some
    old version of VxWorks. It was the only kind included by default. I
    ended up teaching some colleagues on how to edit the command line, vi
    style.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Anssi Saari on Wed Apr 9 01:16:05 2025
    On Tue, 08 Apr 2025 15:39:47 +0300, Anssi Saari wrote:

    The only time I've had to use vi command history editing was with some
    old version of VxWorks. It was the only kind included by default. I
    ended up teaching some colleagues on how to edit the command line, vi
    style.

    Seems a bit dumb, having to go into insert mode every time you actually
    want to type a command.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From c186282@21:1/5 to Lawrence D'Oliveiro on Tue Apr 8 22:32:21 2025
    On 4/8/25 9:16 PM, Lawrence D'Oliveiro wrote:
    On Tue, 08 Apr 2025 15:39:47 +0300, Anssi Saari wrote:

    The only time I've had to use vi command history editing was with some
    old version of VxWorks. It was the only kind included by default. I
    ended up teaching some colleagues on how to edit the command line, vi
    style.

    Seems a bit dumb, having to go into insert mode every time you actually
    want to type a command.

    It's terrible - and was obsolete already by 1985.

    NANO folks !

    Shit, I wrote a near-equiv for DOS, in '85, in
    MASM.

    I actually DELETE/rename all the 'vi' variants so
    they can't accidentally come up .....

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anssi Saari@21:1/5 to Lawrence D'Oliveiro on Wed Apr 9 10:53:45 2025
    Lawrence D'Oliveiro <ldo@nz.invalid> writes:

    Seems a bit dumb, having to go into insert mode every time you actually
    want to type a command.

    Sure. Still, way better than no command history at all.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Anssi Saari on Sat Apr 12 06:55:34 2025
    On Wed, 09 Apr 2025 10:53:45 +0300, Anssi Saari wrote:

    Lawrence D'Oliveiro <ldo@nz.invalid> writes:

    Seems a bit dumb, having to go into insert mode every time you actually
    want to type a command.

    Sure. Still, way better than no command history at all.

    Luckily, that’s not a choice we non-vi/vim-users are faced with.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?St=C3=A9phane?= CARPENTIE@21:1/5 to All on Sat Apr 12 11:23:14 2025
    Le 07-04-2025, Lawrence D'Oliveiro <ldo@nz.invalid> a écrit :
    On 06 Apr 2025 08:40:54 GMT, Stéphane CARPENTIER wrote:

    Le 31-03-2025, Lawrence D'Oliveiro <ldo@nz.invalid> a écrit :

    On 30 Mar 2025 22:04:45 GMT, Stéphane CARPENTIER wrote:

    Yes, with the right option and/or with the right modification of the
    command line. But it's easier and faster to just add a cat than to
    find the "right" way to do it.

    Give an example.

    A lot of time I run cat to find some information in a file. And when the
    file is bigger than expected, I'll just grep its output. Of course,
    it's better to directly grep the file, but it's easier and faster to add
    a grep at the end of the previous command than to either write directly
    the right command or to go at the beginning of the line to remove the
    cat and put grep instead. Mostly when the name of the file is long in a
    far remote directory.

    You do have command-line editing enabled, right? You just press the HOME
    key (or CTRL/A) to go to the start of the line.

    Yes. And then, I have to remove "cat". And only then can I write "grep".
    Which is more difficult than just writing "| grep" at the end of the
    line. So your solution is just a pedantic one to prove you can write a theoretically better command. But it's a more difficult one and without
    any advantage. Because "cat" is so fast that no human being can see the difference in computer ressources with and without it. And it takes me
    more time to think about not using cat than about adding "grep" at the
    end of the line. Because it's more natural: "I have to many output, I
    just reduce them" is faster and easier than to think about I have to
    start at the beginning and think: "Now that I know there are to
    many lines in my file, what what perfect command should I write?"

    So, yes, it's a real example of a UUOC aficionado for no reason. You
    prefer to avoid cat at all cost? Good for you. But telling others they
    should avoid it at all cost just just because one can do better brings
    you in the way of LP/DG/FF/NV/whatever.

    So, you wanted an example of a good reason to use cat when it could be
    avoided? I gave you one. When I want to have a result, I don't want to
    be distracted to think about "the good way to do it". I want my result
    as fast as possible. And I get it. Fast and easy. Your way is just
    cumbersome for no advantage.

    So, now, instead of telling me it's better to avoid cat at all cost,
    tell me why it's better. If I can win 0.00001 second on the result,
    it's useless. If I can spare 0.00001% of my processor ressources, it's
    useless. So, why should I avoid cat as much as is possible? Is there a
    security reason? Is there a real benefit? Or are you just like LP/FF/NV/DG/whatever who claims things because they are written in very
    old books which makes you think you know better than others?

    --
    Si vous avez du temps à perdre :
    https://scarpet42.gitlab.io

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?St=C3=A9phane?= CARPENTIE@21:1/5 to All on Sat Apr 12 13:07:51 2025
    Le 08-04-2025, Eli the Bearded <*@eli.users.panix.com> a écrit :
    In comp.os.linux.misc, Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
    On 06 Apr 2025 08:40:54 GMT, Stéphane CARPENTIER wrote:
    A lot of time I run cat to find some information in a file. And when the >>> file is bigger than expected, I'll just grep its output. Of course,
    it's better to directly grep the file, but it's easier and faster to add >>> a grep at the end of the previous command than to either write directly
    the right command or to go at the beginning of the line to remove the
    cat and put grep instead. Mostly when the name of the file is long in a
    far remote directory.
    You do have command-line editing enabled, right? You just press the HOME
    key (or CTRL/A) to go to the start of the line.

    Very presumptious to assume emacs style line editing, isn't it?

    It's the same using bash in a terminal.

    But really, I don't think it is proper to care about inefficent use of commands at the command line.

    That's what I'm speaking off. In a script shared with others, it's another story. But in a terminal, the UUOC is, to my experience, always done by
    someone wanted to show off, never by someone having a good explanation.

    Go ahead and judge in a script or documentation (or an example posted
    to Usenet), but what people do in the privacy of their own shell is
    their business.

    Yes again. In a script shared with others, one needs to do the right
    thing because it's easier to understand if nothing useless appears in
    it. But in the terminal, one needs to follow his chain of thought and
    get the answer as fast as possible. And, from my experience, taking care
    of removing a cat in a previous command is always slower and more
    difficult than letting it and adding the pipe with the next command at
    the end.

    --
    Si vous avez du temps à perdre :
    https://scarpet42.gitlab.io

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to All on Sun Apr 13 04:54:28 2025
    On 12 Apr 2025 11:23:14 GMT, Stéphane CARPENTIER wrote:

    Yes. And then, I have to remove "cat". And only then can I write "grep". Which is more difficult than just writing "| grep" at the end of the
    line.

    Let’s see:
    * CTRL/A, DEL, DEL, DEL, “grep” (8 keystrokes)
    versus
    * “|grep” (5 keystrokes)

    That’s 60% more work. I suppose that’s a big chunk out of your working
    day ...

    Here’s an even more useless example:

    cat «file» | grep «pattern» | wc -l

    versus

    grep -c «pattern» «file»

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?St=C3=A9phane?= CARPENTIE@21:1/5 to All on Sun Apr 13 18:25:56 2025
    Le 13-04-2025, Lawrence D'Oliveiro <ldo@nz.invalid> a écrit :
    On 12 Apr 2025 11:23:14 GMT, Stéphane CARPENTIER wrote:

    Yes. And then, I have to remove "cat". And only then can I write "grep".
    Which is more difficult than just writing "| grep" at the end of the
    line.

    Let’s see:
    * CTRL/A, DEL, DEL, DEL, “grep” (8 keystrokes)
    versus
    * “|grep” (5 keystrokes)

    That’s 60% more work. I suppose that’s a big chunk out of your working day ...

    Yes, because adding "|grep" comes naturally in mind when removing "cat"
    makes me think about the way to do it. So, I have to stop thinking about
    of what I want to think about the way to get it.

    But, of course, you remove the only important point because you can't
    have any reason. What does it bring me to use grep the right way? I can
    accept an added work if there is some purpose. The purpose is not about limiting my CPU ressources, the difference is invisible. The purpose
    can't be to get the answer faster, because with the added work, it takes
    me more time to have my answer.

    So why do you want to fight the UUOC? Why should I follow your advice?
    Because some pedantic moron considered it was a worthy fight to do a
    long time ago and it has been followed by parrots ever since? If so, it's
    not enough. If you can't come with a good reason for me to add an extra
    work in my workflow, I don't have any reason to follow it. And for now,
    it looks like it's only to follow pedantic morons unable to see a
    purpose on what they do.

    --
    Si vous avez du temps à perdre :
    https://scarpet42.gitlab.io

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From candycanearter07@21:1/5 to Lawrence D'Oliveiro on Sun Apr 13 19:00:04 2025
    Lawrence D'Oliveiro <ldo@nz.invalid> wrote at 04:54 this Sunday (GMT):
    On 12 Apr 2025 11:23:14 GMT, Stéphane CARPENTIER wrote:

    Yes. And then, I have to remove "cat". And only then can I write "grep".
    Which is more difficult than just writing "| grep" at the end of the
    line.

    Let’s see:
    * CTRL/A, DEL, DEL, DEL, “grep” (8 keystrokes)
    versus
    * “|grep” (5 keystrokes)

    That’s 60% more work. I suppose that’s a big chunk out of your working day ...

    Here’s an even more useless example:

    cat «file» | grep «pattern» | wc -l

    versus

    grep -c «pattern» «file»


    You could also add a tee in between the grep and wc -l if you needed it.
    --
    user <candycane> is generated from /dev/urandom

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to All on Mon Apr 14 22:39:37 2025
    On 13 Apr 2025 18:25:56 GMT, Stéphane CARPENTIER wrote:

    So why do you want to fight the UUOC?

    I don’t.

    Why should I follow your advice?

    You don’t.

    All I do is point it out. I don’t even have to say “this is uncool”, you yourself come to the conclusion that they are somehow an uncool way of
    doing things.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?St=C3=A9phane?= CARPENTIE@21:1/5 to All on Thu Apr 17 19:44:55 2025
    Le 14-04-2025, Lawrence D'Oliveiro <ldo@nz.invalid> a écrit :
    On 13 Apr 2025 18:25:56 GMT, Stéphane CARPENTIER wrote:

    So why do you want to fight the UUOC?

    I don’t.

    Why should I follow your advice?

    You don’t.

    All I do is point it out. I don’t even have to say “this is uncool”, you
    yourself come to the conclusion that they are somehow an uncool way of
    doing things.

    The name UUOC, by itself, means it's uncool to do it.

    --
    Si vous avez du temps à perdre :
    https://scarpet42.gitlab.io

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to All on Fri Apr 18 02:18:34 2025
    On 17 Apr 2025 19:44:55 GMT, Stéphane CARPENTIER wrote:

    Le 14-04-2025, Lawrence D'Oliveiro <ldo@nz.invalid> a écrit :

    On 13 Apr 2025 18:25:56 GMT, Stéphane CARPENTIER wrote:

    So why do you want to fight the UUOC?

    I don’t.

    Why should I follow your advice?

    You don’t.

    All I do is point it out. I don’t even have to say “this is uncool”, you
    yourself come to the conclusion that they are somehow an uncool way of
    doing things.

    The name UUOC, by itself, means it's uncool to do it.

    You admit it then? ;)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)