npm-g_nosudo
npm-g_nosudo copied to clipboard
sh: 74: [: UG}: unexpected operator
When running this with wget command on Raspbian I get the following errors:
sh: 74: [: UG}: unexpected operator
sh: 77: [: UG}: unexpected operator
sh: 88: syntax error: Missing '}'
Maybe retry with
wget -O- https://raw.githubusercontent.com/glenpike/npm-g_nosudo/master/npm-g-nosudo.sh | bash
?
With the latter script on bash:
bash: line 142: syntax error near unexpected token `)'
bash: line 142: ` [Yy]* ) fix_env;;'
Got exactly the same errors in both cases on Ubuntu 16.04
@maikokuppe - can you please try running the script as below (I've done a Pull Request with a possible fix)
wget -O- https://raw.githubusercontent.com/glenpike/npm-g_nosudo/b28-case-esac/npm-g-nosudo.sh | bash
Just tried the PR with possible fix, get the following error:
bash: line 142: syntax error near unexpected token `)'
bash: line 142: ` [Yy]*) fix_env;;'
I got exactly the results as the others with the listed scripts. I'm using Xubuntu 16.04.
Getting the same error right now. Ubuntu 16.04
Okay, I've tried fixing this problem again on the branch, please try the following:
wget -O- https://raw.githubusercontent.com/glenpike/npm-g_nosudo/b28-case-esac/npm-g-nosudo.sh | bash
or download the file from the branch and run manually - https://raw.githubusercontent.com/glenpike/npm-g_nosudo/b28-case-esac/npm-g-nosudo.sh
If you have problems, please tell me what shell you are running with the following:
which sh | xargs ls -al
@glenpike I have tried:
wget -O- https://raw.githubusercontent.com/glenpike/npm-g_nosudo/b28-case-esac/npm-g-nosudo.sh | bash
--2018-01-31 18:22:05-- https://raw.githubusercontent.com/glenpike/npm-g_nosudo/b28-case-esac/npm-g-nosudo.sh
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.0.133, 151.101.64.133, 151.101.128.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.0.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3706 (3.6K) [text/plain]
Saving to: ‘STDOUT’
- 100%[===========================================================================================================>] 3.62K --.-KB/s in 0s
2018-01-31 18:22:06 (37.6 MB/s) - written to stdout [3706/3706]
Invalid choice
You may need to add the following to your ~/.bashrc / .zshrc file(s)
export NPM_PACKAGES="/home/tony/.npm-packages"
export NODE_PATH="$NPM_PACKAGES/lib/node_modules${NODE_PATH:+:$NODE_PATH}"
export PATH="$NPM_PACKAGES/bin:$PATH"
# Unset manpath so we can inherit from /etc/manpath via the `manpath`
# command
unset MANPATH # delete if you already modified MANPATH elsewhere in your config
export MANPATH="$NPM_PACKAGES/share/man:$(manpath)"
bash: line 146: syntax error near unexpected token `elif'
bash: line 146: `elif [ $yn = "Y" ]; then'
Here's shell info u have requested:
which sh | xargs ls -al
lrwxrwxrwx 1 root root 7 Jan 24 09:33 /usr/bin/sh -> /bin/sh
And linux info:
lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 9.0 (stretch)
Release: 9.0
Codename: stretch
uname -r
4.14.0-3-amd64
Hi, @a2nt
Okay - it looks like piping the wget output to bash causes issues with the elif statement. If you download 'manually' change permissions and execute it, what happens?
wget -O- https://raw.githubusercontent.com/glenpike/npm-g_nosudo/b28-case-esac/npm-g-nosudo.sh >npm-g-nosudo.sh
Then
chmod 755 npm-g-nosudo.sh
Then
./npm-g-nosudo.sh
(I've just tried this in a brand new vagrant machine on Ubuntu 16.04 using the shell and it seems to behave correctly)
If that's not behaving, do you have bash installed on Debian - I'm guessing I could change the shebang so it has to run under bash, but that might exclude people - I've tried making it compliant as possible, but maybe doing something wrong there.
I just tried this on a Pi and seems to be working as far as I can tell so thank you so much for the continued work and support on this.
Note: This is running using wget.
Thanks @gauntface - is that using master branch or the PR one?