bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] examples/s-f/Bash_aliases: Fix off-by-one error


From: Robert Elz
Subject: Re: [PATCH] examples/s-f/Bash_aliases: Fix off-by-one error
Date: Sun, 21 Sep 2025 06:02:01 +0700

    Date:        Sat, 20 Sep 2025 15:57:08 -0400
    From:        Greg Wooledge <greg@wooledge.org>
    Message-ID:  <20250920195708.GT22894@wooledge.org>

  |  2) It's using eval "$@".  This is just bad.
  |     It should either be using "$@" without eval,

That I agree is the way it should be.   However:

  |     or it should be using eval "$*" which would join the
  |     command arguments into a single string.

That would be the wrong way.   Using "$*" makes it depend upon IFS,
which "$@" does not, and if given multiple args, eval combines them
into a single string (with spaces as separators).   "$@" would be
better, if there was a reason to use eval (which there isn't, that would
only make sense if the command were to be provided some way to access
the repeat count - and in any case, that would not be repeating a
command, it would be running a sequence of related different commands).

kre




reply via email to

[Prev in Thread] Current Thread [Next in Thread]