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

test to [[ where available #261

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft

test to [[ where available #261

wants to merge 5 commits into from

Conversation

balupton
Copy link
Member

@balupton balupton commented Oct 28, 2024

This convention change improves performance and resolves edge cases when test -n "$a" -a "$b" = "$c" where a=>.

fixes:

  • init.sh: fix a missing -d
  • github-download: fix a missing -n
  • is-missing: fix incorrect help text on exit status
  • mount-helper: fix two missing -n, one of them seems better to not exist (as we should always just want the first line in that case)
  • setup-git: fix a missing test/[[
  • waiter: fix missing -n

other changes:

  • add is-(directory|file|missing|not-directory|present|readable)(.bash)?, such that sudo doesn't have to call problematic test command

todos:

  • note this change of convention in the docs
  • review the PR to check if there were any errors

fixes:

- init.sh: fix a missing `-d`
- github-download: fix a missing `-n`
- mount-helper: fix a missing `-n`
- setup-git: fix a missing `test`/`[[`
- waiter: fix missing `-n`

todos:

- note this change of convention in the docs
- see if there is an alternative for the sudo calls
- review the PR to check if there were any errors
@balupton balupton marked this pull request as draft October 28, 2024 12:03
@balupton balupton self-assigned this Oct 28, 2024
- add `is-(directory|file|missing|not-directory|present|readable)(.bash)?`
- is-missing: fix incorrect help text on exit status
- mount-helper: fix missing `-n`, however seems better to just always fetch a single line here
- debug-network: fix WIP commit using `[[` in a sh script, instead of `[`
- `while true` to `while :`, and `true` to `:` where appropriate
- brew: compact a conditional
- (choose|config-helper|confirm|echo-lines|is-empty-value|setup-(git|linux|mac|system)): compact an or conditional
- is-suffix: update for `__substr` shim in `bash.bash` for bash v3 support
- `is-dir`: move to deprecated, as there is now `is-directory`
bg="${bg##*;}" # trim everything prior to the last ;
if test "$bg" = 'default' || test "$bg" -le 6 -o "$bg" -eq 8; then
if [[ $bg == 'default' ]] || (is-digit -- "$bg" && [[ $bg -le 6 || $bg -eq 8 ]]); then
Copy link
Member Author

Choose a reason for hiding this comment

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

the introduction of is-digit here is a sanity check to prevent weird behaviour

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant