Skip to content
This repository has been archived by the owner on Nov 21, 2018. It is now read-only.

Bashisms while #!/bin/sh #47

Open
vi opened this issue Mar 9, 2016 · 2 comments · May be fixed by #50
Open

Bashisms while #!/bin/sh #47

vi opened this issue Mar 9, 2016 · 2 comments · May be fixed by #50

Comments

@vi
Copy link

vi commented Mar 9, 2016

$ multirust update nightly
multirust: installing toolchain 'nightly'
rustup: gpg available. signatures will be verified
/home/vi/home/rust/prefix/bin/rustup.sh: 1512: [: 1: unexpected operator
rustup: downloading manifest for 'nightly'
^C

$ checkbashisms /home/vi/home/rust/prefix/bin/rustup.sh
possible bashism in /home/vi/home/rust/prefix/bin/rustup.sh line 84 ('command' with option other than -p):
    if command -v gpg2 > /dev/null 2>&1; then
possible bashism in /home/vi/home/rust/prefix/bin/rustup.sh line 88 ('command' with option other than -p):
    if command -v "$gpg_exe" > /dev/null 2>&1; then
possible bashism in /home/vi/home/rust/prefix/bin/rustup.sh line 1388 ('command' with option other than -p):
    if command -v "$sha256sum_cmd" > /dev/null 2>&1; then
possible bashism in /home/vi/home/rust/prefix/bin/rustup.sh line 1390 ('command' with option other than -p):
    elif command -v shasum > /dev/null 2>&1; then
possible bashism in /home/vi/home/rust/prefix/bin/rustup.sh line 1407 ('command' with option other than -p):
    if command -v "$sha256sum_cmd" > /dev/null 2>&1; then
possible bashism in /home/vi/home/rust/prefix/bin/rustup.sh line 1409 ('command' with option other than -p):
    elif command -v shasum > /dev/null 2>&1; then
possible bashism in /home/vi/home/rust/prefix/bin/rustup.sh line 1512 (should be 'b = a'):
            if [ $? == 0 ]; then
possible bashism in /home/vi/home/rust/prefix/bin/rustup.sh line 1787 (read with option other than -r):
    read -p "Continue? (y/N) " _yn < /dev/tty

Maybe it should be #!/bin/bash?

@nikolaykasyanov
Copy link

I'm getting the same /home/vi/home/rust/prefix/bin/rustup.sh: 1512: [: 1: unexpected operator on Ubuntu Trusty

vi added a commit to vi/rustup that referenced this issue Apr 3, 2016
@vi vi linked a pull request Apr 3, 2016 that will close this issue
@sanmai-NL
Copy link
Contributor

The command -v lines are false alarms. Even under the dash shell, Debian's /bin/sh these commands work:

$ command -p whoami
sanmai
$ command -v whoami
/usr/bin//whoami

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

Successfully merging a pull request may close this issue.

4 participants
@nikolaykasyanov @vi @sanmai-NL and others