• Re: handy shell function/alias that wraps bc

    From gazelle@gazelle@shell.xmission.com (Kenny McCormack) to comp.unix.shell on Mon Nov 3 17:33:44 2025
    From Newsgroup: comp.unix.shell

    In article <10eakvt$30ji5$1@dont-email.me>,
    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
    On 03.11.2025 17:11, Kenny McCormack wrote:
    [...]

    It is all kind of a bodge and it would have been better if it could have
    just been integrated into $(( ... )), like in ksh. [...]

    Indeed. Especially if the lib is just adding FP (and nothing else).

    That's pretty much the way bash loadables work (*). There is usually a
    1-to-1 relationship between the file and the command that it implements.

    This is not required - and there are exceptions - but it is the general pattern.

    (*) GAWK is similar.
    --
    The randomly chosen signature file that would have appeared here is more than 4 lines long. As such, it violates one or more Usenet RFCs. In order to remain in compliance with said RFCs, the actual sig can be found at the following URL:
    http://user.xmission.com/~gazelle/Sigs/Windows
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Lawrence =?iso-8859-13?q?D=FFOliveiro?=@ldo@nz.invalid to comp.unix.shell on Mon Nov 3 20:06:30 2025
    From Newsgroup: comp.unix.shell

    On Mon, 3 Nov 2025 14:03:18 +0000, Richard Harnden wrote:

    Everything, it seems to me, is just easier with ksh.

    The saying rCLto someone with a hammer, every problem looks like a nailrCY comes to mind ...
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Janis Papanagnou@janis_papanagnou+ng@hotmail.com to comp.unix.shell on Mon Nov 3 21:25:47 2025
    From Newsgroup: comp.unix.shell

    On 03.11.2025 21:06, Lawrence DrCOOliveiro wrote:
    On Mon, 3 Nov 2025 14:03:18 +0000, Richard Harnden wrote:

    Everything, it seems to me, is just easier with ksh.

    The saying rCLto someone with a hammer, every problem looks like a nailrCY comes to mind ...

    Richard was comparing Ksh with Bash here. - And only a blind man would
    disagree with him. (Or someone not knowing these shells and religiously adhering to some dogma.)

    There's a few details where Bash has a "pro", but only very very few.

    Richard's "everything" is of course debatable in that light, but it's
    already more than compensated by his "it seems to me", a subjective
    summarized feeling.

    Janis

    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Kaz Kylheku@643-408-1753@kylheku.com to comp.unix.shell on Mon Nov 3 21:11:35 2025
    From Newsgroup: comp.unix.shell

    On 2025-11-03, Lawrence DrCOOliveiro <ldo@nz.invalid> wrote:
    On Mon, 3 Nov 2025 14:03:18 +0000, Richard Harnden wrote:

    Everything, it seems to me, is just easier with ksh.

    The saying rCLto someone with a hammer, every problem looks like a nailrCY

    Including your pin-like head.
    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Christian Weisgerber@naddy@mips.inka.de to comp.unix.shell on Mon Nov 3 23:19:26 2025
    From Newsgroup: comp.unix.shell

    On 2025-11-03, Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:

    $ zsh -c 'echo $(( 1.0+2.3 ))'
    3.2999999999999998

    $ ksh -c 'echo $(( 1.0+2.3 ))'
    3.3

    Zsh is not really confidence-inspiring here. - Hmm..

    I think 0.3 cannot be represented in binary floating point format,
    so you are getting an approximation. Zsh and ksh appear to apply
    different rounding on output. It's probably just the difference
    between %.17g and %g or such.
    --
    Christian "naddy" Weisgerber naddy@mips.inka.de
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Kaz Kylheku@643-408-1753@kylheku.com to comp.unix.shell on Tue Nov 4 00:35:09 2025
    From Newsgroup: comp.unix.shell

    On 2025-11-03, Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
    On 03.11.2025 17:11, Kenny McCormack wrote:
    [...]

    It is all kind of a bodge and it would have been better if it could have
    just been integrated into $(( ... )), like in ksh. [...]

    Indeed. Especially if the lib is just adding FP (and nothing else).
    Also with the paragon of Ksh or Zsh using already $((...)) for that.
    I also cannot see an extension of $((...)) would break anything in
    Bash, or would it?

    Alas, re: Zsh, I just noticed...

    $ zsh -c 'echo $(( 1.0+2.3 ))'
    3.2999999999999998

    $ ksh -c 'echo $(( 1.0+2.3 ))'
    3.3

    Zsh is not really confidence-inspiring here. - Hmm..

    It's just an artifact of rounding the number when printing, together
    with the inability of 1/3 to have an exact representation in binary.

    IEEE 64 bit floats can record a 15 digit number and reproduce
    every digit.

    The reverse is not the case; 15 decimal mantissa digits are not enough
    to record every IEEE 64 bit value.

    You need 17 digits. Look: that's exactly the digit count in the zsh
    output.

    When you print 17 digits, that reveals the approximation that is
    being used: it is slightly less than 3 1/3.

    When you print to 15 digits, it disappears in the rounding.

    This is the TXR Lisp interactive listener of TXR 302.
    Quit with :quit or Ctrl-D on an empty line. Ctrl-X ? for cheatsheet.
    0.3
    0.3
    *print-flo-precision*
    15
    (set *print-flo-precision* 17)
    17
    0.3
    0.29999999999999999


    A similar experiment can be conducted with printf, playing with the
    precision value in the formatting, between 15 and 17.

    Note that like ksh, I set the default to 15. By that, I am pandering
    to the "optics". Zsh decided not to pander to optics and stick with
    precision: output the number in such a way that if it is transmitted
    to another program and converted back to 64 bit double, the same
    number will be reproduced. By printing to 15 digits, we lose that transparency. We alias several possible approximations of 3.3 to one textual representation.
    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Kaz Kylheku@643-408-1753@kylheku.com to comp.unix.shell on Tue Nov 4 01:04:28 2025
    From Newsgroup: comp.unix.shell

    On 2025-11-04, Kaz Kylheku <643-408-1753@kylheku.com> wrote:
    IEEE 64 bit floats can record a 15 digit number and reproduce
    every digit.

    Trivia: this 15 value is in the ISO C <float.h> under the name DBL_DIG.
    (I mean, on platforms with IEEE 64 bit doubles, of course.)

    The 17 value appears under the name DBL_DECIMAL_DIG.

    DBL_DIG is how many digits of decimal precision can we round-trip
    into double and back.

    DBL_DECIMAL_DIG is how many decimal digits we need to round trip
    a double to decimal text and back.

    I think DBL_DECIMAL_DIG might be newer. ANSI C89 / ISO C90 had DBL_DIG,
    but I seem to recall even C99 didn't have DBL_DECIMAL_DIG yet.
    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Janis Papanagnou@janis_papanagnou+ng@hotmail.com to comp.unix.shell on Tue Nov 4 05:34:08 2025
    From Newsgroup: comp.unix.shell

    On 04.11.2025 00:19, Christian Weisgerber wrote:
    On 2025-11-03, Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:

    $ zsh -c 'echo $(( 1.0+2.3 ))'
    3.2999999999999998

    $ ksh -c 'echo $(( 1.0+2.3 ))'
    3.3

    Zsh is not really confidence-inspiring here. - Hmm..

    I think 0.3 cannot be represented in binary floating point format,
    so you are getting an approximation. Zsh and ksh appear to apply
    different rounding on output. It's probably just the difference
    between %.17g and %g or such.

    Yes, sure. - It's just that my "simple" pocket-calculator that
    I bought around 1980 does not show such obvious rounding errors
    (i.e. with numbers it can not exactly represent).

    Janis

    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Kaz Kylheku@643-408-1753@kylheku.com to comp.unix.shell on Tue Nov 4 04:40:26 2025
    From Newsgroup: comp.unix.shell

    On 2025-11-04, Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
    On 04.11.2025 00:19, Christian Weisgerber wrote:
    On 2025-11-03, Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:

    $ zsh -c 'echo $(( 1.0+2.3 ))'
    3.2999999999999998

    $ ksh -c 'echo $(( 1.0+2.3 ))'
    3.3

    Zsh is not really confidence-inspiring here. - Hmm..

    I think 0.3 cannot be represented in binary floating point format,
    so you are getting an approximation. Zsh and ksh appear to apply
    different rounding on output. It's probably just the difference
    between %.17g and %g or such.

    Yes, sure. - It's just that my "simple" pocket-calculator that
    I bought around 1980 does not show such obvious rounding errors
    (i.e. with numbers it can not exactly represent).

    Calculators use the same base for calculating that they do for
    displaying and input. That makes all the difference.

    You literally cannot input anything into your calculator that
    it cannot represent. It supports an exact representation of 0.3,
    or anything else you can punch in.

    You can calculate something it cannot represent, like dividing 1 by 3.
    But it does that in decimal and can truncate and round as you would
    using pencil-and-paper calculations. If it agrees with pencil-and-paper
    model decimal calculations, you will find it flawless. :)
    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Janis Papanagnou@janis_papanagnou+ng@hotmail.com to comp.unix.shell on Tue Nov 4 05:57:31 2025
    From Newsgroup: comp.unix.shell

    On 04.11.2025 05:40, Kaz Kylheku wrote:
    On 2025-11-04, Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
    On 04.11.2025 00:19, Christian Weisgerber wrote:
    On 2025-11-03, Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote: >>>
    $ zsh -c 'echo $(( 1.0+2.3 ))'
    3.2999999999999998

    $ ksh -c 'echo $(( 1.0+2.3 ))'
    3.3

    Zsh is not really confidence-inspiring here. - Hmm..

    I think 0.3 cannot be represented in binary floating point format,
    so you are getting an approximation. Zsh and ksh appear to apply
    different rounding on output. It's probably just the difference
    between %.17g and %g or such.

    Yes, sure. - It's just that my "simple" pocket-calculator that
    I bought around 1980 does not show such obvious rounding errors
    (i.e. with numbers it can not exactly represent).

    Calculators use the same base for calculating that they do for
    displaying and input. That makes all the difference.

    You literally cannot input anything into your calculator that
    it cannot represent. It supports an exact representation of 0.3,
    or anything else you can punch in.

    You can calculate something it cannot represent, like dividing 1 by 3.
    But it does that in decimal and can truncate and round as you would
    using pencil-and-paper calculations. If it agrees with pencil-and-paper
    model decimal calculations, you will find it flawless. :)

    That old one (that I still use) uses BCD, it displays mantissas
    of 10 digits, it uses internally 12 digits for the calculations,
    and does rounding. Yes. It handles and displays correctly both
    arithmetic (by internal rounding with two spare decimal digits),
    those it can represent exactly (like 0.1, a "problematic" value
    in binary encoding), and those it cannot represent exactly (like
    the result of an [intermediate] value of 1/3.

    Here, in the topic of shells, as depicted above, I see what Ksh
    produces in a _simple expression_, and I see the Zsh behavior.
    (I wouldn't even want to imagine how errors propagate in Zsh.)

    Janis

    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Ed Morton@mortonspam@gmail.com to comp.unix.shell on Tue Nov 4 16:49:57 2025
    From Newsgroup: comp.unix.shell

    On 11/2/2025 7:53 PM, Lawrence DrCOOliveiro wrote:
    On Sun, 2 Nov 2025 16:58:54 -0600, Ed Morton wrote:

    On 11/1/2025 3:21 PM, Lawrence DrCOOliveiro wrote:
    On Sat, 1 Nov 2025 11:47:47 -0500, Ed Morton wrote:

    It's not clear why you'd use bc instead of awk to evaluate the
    expression, e.g. using any POSIX awk:

    I never bothered with Awk. I realized early on that Perl did everything
    that Awk could do, and a lot more, just as concisely.

    Conciseness is brevity plus clarity and perl scripts are invariably
    missing one of those qualities.

    Nope. Things like rCLperl -lnerCY or even rCLperl -lneprCY allow you to write short one-liners that are just as powerful as anything in Awk.

    Standard perl proponent type of response there.

    The rest of the world: "perl scripts lack clarity"/"deserts lack water"
    Perl proponents: "No, perl scripts are short and powerful"/"No, deserts
    have sand and heat".

    Ah well, not worth discussing further.

    Ed.
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Kaz Kylheku@643-408-1753@kylheku.com to comp.unix.shell on Tue Nov 4 23:06:53 2025
    From Newsgroup: comp.unix.shell

    On 2025-11-03, Lawrence DrCOOliveiro <ldo@nz.invalid> wrote:
    On Sun, 2 Nov 2025 16:58:54 -0600, Ed Morton wrote:

    On 11/1/2025 3:21 PM, Lawrence DrCOOliveiro wrote:
    On Sat, 1 Nov 2025 11:47:47 -0500, Ed Morton wrote:

    It's not clear why you'd use bc instead of awk to evaluate the
    expression, e.g. using any POSIX awk:

    I never bothered with Awk. I realized early on that Perl did everything
    that Awk could do, and a lot more, just as concisely.

    Conciseness is brevity plus clarity and perl scripts are invariably
    missing one of those qualities.

    Nope. Things like rCLperl -lnerCY or even rCLperl -lneprCY allow you to write
    short one-liners that are just as powerful as anything in Awk.

    There Is More Than One Way To Do It!

    For instance, -lnep can appear in any of these combinations:

    (flow "lnep" perm tprint)
    lnep
    lnpe
    lenp
    lepn
    lpne
    lpen
    nlep
    nlpe
    nelp
    nepl
    nple
    npel
    elnp
    elpn
    enlp
    enpl
    epln
    epnl
    plne
    plen
    pnle
    pnel
    peln
    penl

    Essentially 24 different tokens for the same configuration.

    No Perl one-liner is shorter than awk'!a[$0]++'.

    "I still say awk { print $1} a lot!" --- Larry Wall

    The options to set up an Awk-like input processing loop take up
    characters. They way you reference $0 is longer too. The array will
    need a % sigil on it.

    That whole sigil thing is retarded. And why would you choose
    stream names to be the thing that doesn't have sigis? How often
    do you manipulate streams compared to variables? Streams can often
    be made implicit (output goes to stdout, input from stdin).

    Awk function: practically the prototype for Javascript:

    function f(x, y)
    {
    return x + y;
    }

    Perl:

    sub f {
    my ($x, $y) = @_;
    return $x + $y;
    }

    Yikes!
    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Lawrence =?iso-8859-13?q?D=FFOliveiro?=@ldo@nz.invalid to comp.unix.shell on Wed Nov 5 00:06:02 2025
    From Newsgroup: comp.unix.shell

    On Tue, 4 Nov 2025 16:49:57 -0600, Ed Morton wrote:

    On 11/2/2025 7:53 PM, Lawrence DrCOOliveiro wrote:

    On Sun, 2 Nov 2025 16:58:54 -0600, Ed Morton wrote:

    On 11/1/2025 3:21 PM, Lawrence DrCOOliveiro wrote:

    On Sat, 1 Nov 2025 11:47:47 -0500, Ed Morton wrote:

    It's not clear why you'd use bc instead of awk to evaluate the
    expression, e.g. using any POSIX awk:

    I never bothered with Awk. I realized early on that Perl did
    everything that Awk could do, and a lot more, just as concisely.

    Conciseness is brevity plus clarity and perl scripts are invariably
    missing one of those qualities.

    Nope. Things like rCLperl -lnerCY or even rCLperl -lneprCY allow you to write
    short one-liners that are just as powerful as anything in Awk.

    Standard perl proponent type of response there.

    Which doesnrCOt exactly refute my point, does it?
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Jim@zsd+ng@jdvb.ca to comp.unix.shell on Fri Nov 7 10:09:57 2025
    From Newsgroup: comp.unix.shell

    On 2025-10-31 at 03:38 ADT, Lawrence DrCOOliveiro <ldo@nz.invalid> wrote:
    On Fri, 31 Oct 2025 06:32:18 -0000 (UTC), Michael Sanders wrote:

    usage example: exp 5*2-1

    ldo@theon:~> bc <<<'5*2-1'
    9

    DonrCOt need a whole script to save a few characters of typing ...

    Or in zsh, to avoid having to type quotes

    In .zshrc put
    aliases[==]='noglob bcfn'
    bcfn () {
    echo "scale=6 ; $*" | bc
    }

    At the prompt type

    $ == 5*2+1
    11
    $

    Jim
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Lawrence =?iso-8859-13?q?D=FFOliveiro?=@ldo@nz.invalid to comp.unix.shell on Sat Nov 8 00:00:54 2025
    From Newsgroup: comp.unix.shell

    On Fri, 7 Nov 2025 10:09:57 -0400, Jim wrote:

    On 2025-10-31 at 03:38 ADT, Lawrence DrCOOliveiro <ldo@nz.invalid> wrote:

    On Fri, 31 Oct 2025 06:32:18 -0000 (UTC), Michael Sanders wrote:

    usage example: exp 5*2-1

    ldo@theon:~> bc <<<'5*2-1'
    9

    DonrCOt need a whole script to save a few characters of typing ...

    Or in zsh, to avoid having to type quotes

    In .zshrc put
    aliases[==]='noglob bcfn'
    bcfn () {
    echo "scale=6 ; $*" | bc
    }

    At the prompt type

    $ == 5*2+1
    11
    $

    Interesting: this

    ==() { bc <<<"scale=6; $*"; }

    is directly valid in bash, but not zsh.

    This definition

    bcfn() { bc <<<"scale=6; $*"; }

    was accepted, but then

    bcfn 5*2+1

    produced the error

    zsh: no matches found: 5*2+1

    (Did print the answer rCL11rCY in bash, but probably unsafe there too.)
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Christian Weisgerber@naddy@mips.inka.de to comp.unix.shell on Sat Nov 8 16:51:25 2025
    From Newsgroup: comp.unix.shell

    On 2025-11-08, Lawrence DrCOOliveiro <ldo@nz.invalid> wrote:

    This definition

    bcfn() { bc <<<"scale=6; $*"; }

    was accepted, but then

    bcfn 5*2+1

    produced the error

    zsh: no matches found: 5*2+1

    The issue here is that 5*2+1 is interpreted as a glob to be expanded. Apparently you don't have any files matching this in your current
    directory.

    (Did print the answer rCL11rCY in bash, but probably unsafe there too.)

    You can tell bash to error out when glob expansion fails:

    bash$ shopt -s failglob
    bash$ bcfn 5*2+1
    bash: no match: 5*2+1

    I think it's safe to assume that you can also toggle zsh's behavior.

    But really, what all this means is that you want to call

    bcfn '5*2+1'

    or

    bcfn 5\*2+1
    --
    Christian "naddy" Weisgerber naddy@mips.inka.de
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Lawrence =?iso-8859-13?q?D=FFOliveiro?=@ldo@nz.invalid to comp.unix.shell on Sat Nov 8 21:55:35 2025
    From Newsgroup: comp.unix.shell

    On Sat, 8 Nov 2025 16:51:25 -0000 (UTC), Christian Weisgerber wrote:

    The issue here is that 5*2+1 is interpreted as a glob to be expanded.

    ThatrCOs what the person I was replying to was doing.
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Jim Diamond@zsd@jdvb.ca to comp.unix.shell on Wed Nov 19 20:37:26 2025
    From Newsgroup: comp.unix.shell

    On 2025-11-07 at 20:00 AST, Lawrence DrCOOliveiro <ldo@nz.invalid> wrote:
    On Fri, 7 Nov 2025 10:09:57 -0400, Jim wrote:

    On 2025-10-31 at 03:38 ADT, Lawrence DrCOOliveiro <ldo@nz.invalid> wrote: >>>
    On Fri, 31 Oct 2025 06:32:18 -0000 (UTC), Michael Sanders wrote:

    usage example: exp 5*2-1

    ldo@theon:~> bc <<<'5*2-1'
    9

    DonrCOt need a whole script to save a few characters of typing ...

    Or in zsh, to avoid having to type quotes

    In .zshrc put
    aliases[==]='noglob bcfn'
    bcfn () {
    echo "scale=6 ; $*" | bc
    }

    At the prompt type

    $ == 5*2+1
    11
    $

    Interesting: this

    ==() { bc <<<"scale=6; $*"; }

    is directly valid in bash, but not zsh.


    This definition

    bcfn() { bc <<<"scale=6; $*"; }

    was accepted, but then

    bcfn 5*2+1

    produced the error

    zsh: no matches found: 5*2+1

    (Did print the answer rCL11rCY in bash, but probably unsafe there too.)

    The joys of the subtle differences between different shells...

    I was originally going to say "I generally don't use bash, but I will admit
    to being surprised that bash doesn't try to glob the argument(s)".
    But then I tried some spaces, for visual appeal:

    $ ==() { bc <<<"scale=6; $*"; }
    $ == 3 * 4
    (standard_in) 1: syntax error
    (standard_in) 1: syntax error
    (standard_in) 1: syntax error
    (standard_in) 1: syntax error
    (standard_in) 1: syntax error


    With my zsh definitions,
    $ == 3 * 4
    12
    as expected.

    Jim
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Brian Patrie@bpatrie@bellsouth.spamisicky.net to comp.unix.shell on Sun Nov 23 14:40:48 2025
    From Newsgroup: comp.unix.shell

    Jim Diamond wrote:
    ...I will admit to being surprised that bash doesn't try
    to glob the argument(s)...

    It does. But upon failure, bash follows the (dangerous) precedent, established by sh, of passing globs that don't match anything as
    literals. The danger in this is that, if you get in the habit of
    relying upon the behaviour, you might find it matching something when
    you didn't expect it.

    I much prefer zsh's (default) behaviour of complaining. I can quote the thing, or use noglob if needed.
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Lawrence =?iso-8859-13?q?D=FFOliveiro?=@ldo@nz.invalid to comp.unix.shell on Sun Nov 23 20:58:43 2025
    From Newsgroup: comp.unix.shell

    On Sun, 23 Nov 2025 14:40:48 -0600, Brian Patrie wrote:

    Jim Diamond wrote:

    ...I will admit to being surprised that bash doesn't try to glob
    the argument(s)...

    It does. But upon failure, bash follows the (dangerous) precedent, established by sh, of passing globs that don't match anything as
    literals. The danger in this is that, if you get in the habit of
    relying upon the behaviour, you might find it matching something
    when you didn't expect it.

    ThatrCOs what rCLshopt failglobrCY is for.
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Jim Diamond@zsd@jdvb.ca to comp.unix.shell on Mon Nov 24 21:12:30 2025
    From Newsgroup: comp.unix.shell

    On 2025-11-23 at 16:40 AST, Brian Patrie <bpatrie@bellsouth.spamisicky.net> wrote:
    Jim Diamond wrote:
    ...I will admit to being surprised that bash doesn't try
    to glob the argument(s)...

    It does. But upon failure, bash follows the (dangerous) precedent, established by sh, of passing globs that don't match anything as
    literals. The danger in this is that, if you get in the habit of
    relying upon the behaviour, you might find it matching something when
    you didn't expect it.

    I much prefer zsh's (default) behaviour of complaining. I can quote the thing, or use noglob if needed.

    Duh. It is so long since I used a shell which passes through unmatched
    globs that I forget such things exist.

    Thanks for the reminder. That is sort of a dangerous thing to forget.

    Jim
    --- Synchronet 3.21a-Linux NewsLink 1.2