Improve shell scripts syntax
What does this MR do?
This MR refactors the shell scripts in GitLab CE repository. To achieve better code quality, make the code more robust. For the details, please take a look at the commit message.
References from ShellCheck Wiki are attached in the commit message as much as I can, but not all the commits come with the reference, please let me know if the commit message is not clear enough and need more explanation, I'll do my best to make it more clear or detail.
I'd like to integrate tools like ShellCheck or shfmt with CI pipeline once the fixes are all done, and make future changes being checked automatically to ensure the quality, hope that's also what you want.
I'd also like to discuss about a not committed idea, as I see most of the shell scripts use shebang in the form of #!/bin/sh
, but some of them, like bin/parallel-rsync-repos
& scripts/lint-doc.sh
, they use #!/usr/bin/env sh
. There are pros and cons, like the previous one is more specific and predictable and the second one would be more portable in difference environments, but no matter what, I think they should use a single approach here, do you guys have any idea or suggestions? Would be happy to discuss with you!
Please do not squash them into a single commit as they all have their individual meaning and should be separated.
Changelog will be attached once this merge request is approved. Thank you.
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry for user-facing changes, or community contribution. Check the link for other scenarios. -
Documentation created/updated or follow-up review issue created -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content