No.

They’re ugly enough in C, and they can easily be transformed into
something portable:

    for ((a; b; c)); do
        blah
    done

↓

    (( a ))
    while (( b )); do
        blah
        (( c ))
    done

So, *really*, no. I’m translating for loops in C source into while loops
as I go, even.

** Changed in: mksh
   Importance: Undecided => Wishlist

** Changed in: mksh
       Status: New => Opinion

-- 
You received this bug notification because you are a member of mksh
Mailing List, which is subscribed to mksh.
Matching subscriptions: mkshlist-to-mksh-bugmail
https://bugs.launchpad.net/bugs/1749741

Title:
  bash-style for (()) loops

Status in mksh:
  Opinion

Bug description:
  LTP (https://github.com/linux-test-project/ltp) has a lot of scripts
  using the bash for (()) loops, as described in the bash manual:
  ```
  An alternate form of the for command is also supported:

  for (( expr1 ; expr2 ; expr3 )) ; do commands ; done

  First, the arithmetic expression expr1 is evaluated according to the
  rules described below (see Shell Arithmetic). The arithmetic
  expression expr2 is then evaluated repeatedly until it evaluates to
  zero. Each time expr2 evaluates to a non-zero value, commands are
  executed and the arithmetic expression expr3 is evaluated. If any
  expression is omitted, it behaves as if it evaluates to 1. The return
  value is the exit status of the last command in commands that is
  executed, or false if any of the expressions is invalid.
  ``` (https://www.gnu.org/software/bash/manual/bash.html#Looping-Constructs)

  these aren't supported by mksh (or by dash, according to
  http://man7.org/linux/man-pages/man1/dash.1.html).

  do you feel like this bash extension is in scope for mksh? i might be
  able to contribute an implementation (though i have a long-standing
  line editing bug i should fix first), but i wanted to check first
  whether this would be considered useful enough?

To manage notifications about this bug go to:
https://bugs.launchpad.net/mksh/+bug/1749741/+subscriptions

Reply via email to