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

Make the main script POSIX-compatible #14

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from

Conversation

stefanct
Copy link

@stefanct stefanct commented May 1, 2024

I think scripts that are supposed as aids in compatibility checks should be most compatible themselves. Therefore I've spent some time on getting rid all the bashism in the main script. Performance is certainly impacted (and most probably slightly negatively) but I've tried to keep everything backward-compatible including the argument checks. All tests keep passing throughout the patch series.

stefanct added 10 commits May 2, 2024 00:40
To that end, wrap the existing test in a for loop.
$HOSTNAME is a bash extension that seems to use the uname syscall just
like a plain hostname call does.
This increases the scope of these variables to all functions.
All instances have been checked for obvious side effects.
Most importantly, replace regex use in if conditions with most simple
parameter expansions and case/esac pattern matching.
Additionally, replace all instances of double-bracket ifs with single-
bracket versions.
The grep call to test the for legal characters can be replaced by an
equivalence check involving a parameter substitution that removes any
illegal characters.
The other simple cases are simply replaced with echo pipes.
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.

1 participant