Skip to content

Error message in init.sh due to using == instead of = in an if #1283

Closed
@chrisdsloan

Description

@chrisdsloan

🐛 Bug description

Running the install (init.sh), it printed an error message ("sh: 139: [: x86_64: unexpected operator"). The error message is caused because == is used instead of = in the if on line 139 of init.sh.

🤔 Expected Behavior

No error message from the if comparison.

👟 Steps to reproduce

$ curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
sh: 139: [: x86_64: unexpected operator
info: downloading wasm-pack
info: successfully installed wasm-pack to `/home/cds/.cargo/bin/wasm-pack`

Here's my fix:

diff --git a/docs/_installer/init.sh b/docs/_installer/init.sh
index 91ec0af..6fb08c0 100644
--- a/docs/_installer/init.sh
+++ b/docs/_installer/init.sh
@@ -136,7 +136,7 @@ get_architecture() {
     esac
 
     # See https://github.com/rustwasm/wasm-pack/pull/1088
-    if [ "$_cputype" == "aarch64" ] && [ "$_ostype" == "apple-darwin" ]; then
+    if [ "$_cputype" = "aarch64" ] && [ "$_ostype" = "apple-darwin" ]; then
         _cputype="x86_64"
     fi
 

🌍 Your environment

I'm running on Pop!_OS 20.04 LTS on an x86 laptop. The bash version is "5.0.17(1)-release".

wasm-pack version: wasm-pack 0.11.0. The error is present in master (48177dc) as well.
rustc version: rustc 1.68.1 (8460ca823 2023-03-20)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions