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

Change = conditional to == #591

Merged
merged 1 commit into from
Apr 6, 2020
Merged

Conversation

randshell
Copy link
Contributor

No description provided.

@angristan
Copy link
Owner

Please provide a reason for the change...

@randshell
Copy link
Contributor Author

= is for variable assignment and == for conditions

@angristan
Copy link
Owner

That's simply no true, otherwise the script would be completely broken :)

https://stackoverflow.com/a/20449556/6945353

== is a bash-ism, by the way. It's better to use the POSIX =. In bash the two are equivalent, and in plain sh = is the only one guaranteed to work.

@randshell
Copy link
Contributor Author

Well this bash-ism is default on a lot of languages and this script is #!/bin/bash. But it's good to know it works because it's a POSIX standard.

@HenryNe
Copy link
Contributor

HenryNe commented Apr 2, 2020

== is a bash-ism, by the way. It's better to use the POSIX =. In bash the two are equivalent, and in plain sh = is the only one guaranteed to work.

This script only works in bash, because all the [[ ... ]] would not work in sh.
So, If you use [[ ... ]], then should also use ==. My small comment.

@angristan angristan changed the title Change = conditional to == Change = conditional to == Apr 6, 2020
@angristan angristan merged commit ef5d5fa into angristan:master Apr 6, 2020
@randshell randshell deleted the patch-5 branch April 6, 2020 13:46
HenryNe added a commit to HenryNe/openvpn-install that referenced this pull request Apr 7, 2020
timbo2k pushed a commit to timbo2k/openvpn-install that referenced this pull request Dec 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants