Skip to content

Support for 'select' loops - #111

Merged
mjambon merged 2 commits into
masterfrom
mj-select
Oct 10, 2021
Merged

mjambon merged 2 commits into
masterfrom
mj-select

Conversation

@mjambon

@mjambon mjambon commented Oct 9, 2021 •

Copy link
Copy Markdown
Contributor

👋 This adds the select construct, which has the same syntax as for loops except for the first keyword. To keep things simple, this implementation extends $.for_statement. I'm happy to change it if someone thinks we should have a dedicated $.select_statement.

select does this:

$ select x in a b c; do echo "got $x"; break; done
1) a
2) b
3) c
#? 2
got b

btw, I'm working on bash integration into semgrep!

@mjambon
mjambon requested review from aryx and maxbrunsfeld October 9, 2021 09:55
@mjambon
mjambon merged commit 30d369b into master Oct 10, 2021
@verhovsky
verhovsky deleted the mj-select branch October 23, 2022 01:35
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

Successfully merging this pull request may close these issues.

2 participants