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

Running script fails when using "set -e" because post increment #15

Open
mikuhno opened this issue Dec 7, 2023 · 0 comments
Open

Running script fails when using "set -e" because post increment #15

mikuhno opened this issue Dec 7, 2023 · 0 comments

Comments

@mikuhno
Copy link

mikuhno commented Dec 7, 2023

If script is run using "set -e" it crashes on lines 177 ((LINE_NUM++)) and 193 ((SECTIONS_NUM++))
This is because post increment returns value (defaulted at 0) before addition and set -e reads this as false, returning error.

Related stackoverflow: here

Fix is easy enough as lines can be changed to use pre-increment ((++LINE_NUM)) and ((++SECTIONS_NUM))

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

1 participant