On 9/22/25 10:36 AM, Greg Wooledge wrote:
On Mon, Sep 22, 2025 at 10:12:09 -0400, Chet Ramey wrote:
On 9/22/25 3:24 AM, Gioele Barabucci wrote:

+    for ((i=1; i<=n; i++)); do
+        "$@"

You need the eval, otherwise something like

repeat 5 v+=f

fails.

On the other hand, often you *don't* want the eval, because then
something like

     repeat 5 make CFLAGS="-g -O"

or

     file="name has spaces.txt"
     repeat 5 scp "$file" "$host:$dir/"

fails.

Yeah, that's the other side of using eval. You can quote your way out of
this, but you can't evaluate a variable assignment without using eval.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    [email protected]    http://tiswww.cwru.edu/~chet/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to