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

[Bug] Shorthand assignment operator += is not supported by Bash 2 #166

Open
Ph0enixKM opened this issue Jun 10, 2024 · 4 comments
Open

[Bug] Shorthand assignment operator += is not supported by Bash 2 #166

Ph0enixKM opened this issue Jun 10, 2024 · 4 comments
Labels
compiler enhancement New feature or request

Comments

@Ph0enixKM
Copy link
Member

Ph0enixKM commented Jun 10, 2024

We could add a flag --out-version=X in scope of this issue to determine which bash version output should be produced to keep outputted Bash be the most readable possible. By default we'd support Bash 2.

--out-version=3

arr+=("value")

--out-version=2

arr=("${arr[@]}" "value")

Also we could replace seq in range generation for Bash 3 with {a..b} syntax. Example syntax:

--out-version=3

{0..10}

--out-version=2

seq 0 10
@b1ek
Copy link
Member

b1ek commented Jun 11, 2024

wouldn't that mean that we'd have to reimplement translator for each bash version? kinda seems like overkill for me

@Ph0enixKM
Copy link
Member Author

Nope. We could get the version in the syntax module

@Ph0enixKM
Copy link
Member Author

I can create a draft to better visualize this. Bash version 3 isn’t a different language. We could just determine if translating one syntax formula can lead to a bit different representation in resulting Bash.

@Mte90 Mte90 added the enhancement New feature or request label Jun 24, 2024
@Mte90 Mte90 added the compiler label Jul 19, 2024
@Ph0enixKM Ph0enixKM changed the title 🐞 Shorthand assignment operator += is not supported by Bash 2 [Bug] Shorthand assignment operator += is not supported by Bash 2 Sep 16, 2024
@Mte90
Copy link
Member

Mte90 commented Oct 2, 2024

Wondering if it is better a CLI parameter or a comment in the amber file that specify the bash version to support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants