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

chore: Fix more Bash inconsistencies #1021

Merged
merged 1 commit into from
Jan 20, 2023
Merged

Conversation

hyperupcall
Copy link
Collaborator

This mainly fixes the following:

  • Not only are more path-related variables quoted (ie. git-touch, git-scp), but variables like $BRANCH are.
  • Add more -r to read invocations
  • Stuff like $(echo $(printf '%s\n' 'thing')) is changed to $(printf '%s\n' 'thing')

@@ -19,7 +19,7 @@ function usage()
echo " -c|--continue: Continue after the user updates conflicts."
}

while [[ $# > 0 ]]
while [[ $# -gt 0 ]]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this changed? > is be perfectly and expressive find within [[ ... ]], isn't it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

> and < perform lexicographical comparison rather than a numerical comparison in this context, so it was changed to -gt

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Thx for the explanation. With this new knowledge I now have to have a look at some of my own scripts as well :)

@spacewander spacewander merged commit 4611b24 into tj:master Jan 20, 2023
@hyperupcall hyperupcall deleted the bash-fixes-2 branch January 21, 2023 00:24
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.

3 participants