Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement C-style for loops #66

Closed
itszor opened this issue Jan 18, 2018 · 3 comments
Closed

Implement C-style for loops #66

itszor opened this issue Jan 18, 2018 · 3 comments

Comments

@itszor
Copy link

itszor commented Jan 18, 2018

This appears to be a missing feature:

#!/bin/bash
for ((i=0; i<10; i++)); do
  echo $i
done

Result with osh 0.3.0:

Traceback (most recent call last):
  File "/home/andy/git/oilshell/oil/Python-2.7.13/Lib/runpy.py", line 174, in _run_module_as_main
  File "/home/andy/git/oilshell/oil/Python-2.7.13/Lib/runpy.py", line 72, in _run_code
  File "/home/andy/git/oilshell/oil/bin/oil.py", line 509, in <module>
  File "/home/andy/git/oilshell/oil/bin/oil.py", line 492, in main
  File "/home/andy/git/oilshell/oil/bin/oil.py", line 475, in OilMain
  File "/home/andy/git/oilshell/oil/bin/oil.py", line 413, in OshMain
  File "/home/andy/git/oilshell/oil/bin/../core/cmd_exec.py", line 985, in Execute
  File "/home/andy/git/oilshell/oil/bin/../core/cmd_exec.py", line 949, in _Execute
  File "/home/andy/git/oilshell/oil/bin/../core/cmd_exec.py", line 758, in _Dispatch
  File "/home/andy/git/oilshell/oil/bin/../core/cmd_exec.py", line 978, in _ExecuteList
  File "/home/andy/git/oilshell/oil/bin/../core/cmd_exec.py", line 949, in _Execute
  File "/home/andy/git/oilshell/oil/bin/../core/cmd_exec.py", line 845, in _Dispatch
NotImplementedError: 14

Result with bash 4.3.42:

0
1
2
3
4
5
6
7
8
9
@andychu
Copy link
Contributor

andychu commented Jan 18, 2018

OK thanks for looking into this! I will fix this for the next release.

andychu pushed a commit that referenced this issue Jan 19, 2018
Addresses issue #66.

Also:
- Improve the error message when a construct isn't implemented.
andychu pushed a commit that referenced this issue Jan 19, 2018
@andychu
Copy link
Contributor

andychu commented Jan 25, 2018

I just published 0.4.alpha1 and it has this feature:

http://www.oilshell.org/releases.html

Let me know if it doesn't work!

@andychu
Copy link
Contributor

andychu commented Feb 4, 2018

Fixed in 0.4.0 http://www.oilshell.org/blog/2018/02/03.html

@andychu andychu closed this as completed Feb 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants