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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken conditional in gpg.sh #49

Merged
merged 1 commit into from
Jun 27, 2019
Merged

Conversation

grdryn
Copy link
Member

@grdryn grdryn commented Jun 27, 2019

Using if [ works differently than if [[ (the former single square
bracket is a file, the double one is a builtin function (I think)).

When using if [ with -eq, it expects numbers, but == can deal
with strings, which is what we want here.

Some examples:

$ if [ hello -eq hello ]; then echo yes; fi
bash: [: hello: integer expression expected

$ if [ hello == hello ]; then echo yes; fi
yes

$ if [ 1 -eq 1 ]; then echo yes; fi
yes

$ if [[ hello -eq hello ]]; then echo yes; fi
yes

$ if [[ 1 -eq 1 ]]; then echo yes; fi
yes

Note: this should at least fix the initial problem, I'm not sure if there are others further on. I'll build a custom version and try it out. Edit: it works fine with this fix 馃憤

Using `if [` works differently than `if [[` (the former single square
bracket is a file, the double one is a builtin function (I think)).

When using `if [` with `-eq`, it expects numbers, but `==` can deal
with strings, which is what we want here.

Some examples:

```bash
$ if [ hello -eq hello ]; then echo yes; fi
bash: [: hello: integer expression expected

$ if [ hello == hello ]; then echo yes; fi
yes

$ if [ 1 -eq 1 ]; then echo yes; fi
yes

$ if [[ hello -eq hello ]]; then echo yes; fi
yes

$ if [[ 1 -eq 1 ]]; then echo yes; fi
yes
```
@grdryn grdryn requested a review from odra June 27, 2019 09:47
@grdryn grdryn merged commit 226c251 into integr8ly:master Jun 27, 2019
@grdryn grdryn deleted the fix-encryption branch June 27, 2019 10:08
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.

None yet

2 participants