Auto merge of #169 - miller-time:fix-install-script, r=komaeda

fix(installation): Fix rustlings installation check

fixes #147

I did some quick testing with the `-x` check:

```sh
if [ -x "$(notrustlings)" ]
then
    echo "notrustlings does not exist"
else
    echo "notrustlings appears to exist!"
    notrustlings
fi
```

which produced:

```
./test.sh: line 12: notrustlings: command not found
notrustlings appears to exist!
./test.sh: line 17: notrustlings: command not found
```

(consistent with comments in issue)

Using `if ! [ -x "$(command -v <command>)" ]` appears to be the standard way to perform this type of check.
This commit is contained in:
bors 2019-06-11 13:53:07 +00:00
commit b8d59d699b
1 changed files with 1 additions and 2 deletions

View File

@ -94,10 +94,9 @@ git checkout -q tags/$Version
echo "Installing the 'rustlings' executable..." echo "Installing the 'rustlings' executable..."
cargo install --force --path . cargo install --force --path .
if [ -x "$(rustlings)" ] if ! [ -x "$(command -v rustlings)" ]
then then
echo "WARNING: Please check that you have '~/.cargo/bin' in your PATH environment variable!" echo "WARNING: Please check that you have '~/.cargo/bin' in your PATH environment variable!"
fi fi
echo "All done! Run 'rustlings' to get started." echo "All done! Run 'rustlings' to get started."