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

[bug report] startup.sh complains about [[: not found #3397

Closed
JerryChin opened this issue Jul 21, 2020 · 7 comments · Fixed by #3505
Closed

[bug report] startup.sh complains about [[: not found #3397

JerryChin opened this issue Jul 21, 2020 · 7 comments · Fixed by #3505
Assignees
Labels
contribution welcome kind/bug Category issues or prs related to bug.

Comments

@JerryChin
Copy link
Contributor

JerryChin commented Jul 21, 2020

Issue Description

startup.sh complains about [[: not found.

Describe what happened (or what feature you want)

I'm trying to start Nacos in standalone mode by executing:

./startup.sh -m standalone

It output the following:

./startup.sh: 88: ./startup.sh: [[: not found
./startup.sh: 92: ./startup.sh: [[: not found
./startup.sh: 101: ./startup.sh: [[: not found
./startup.sh: 103: ./startup.sh: [[: not found
./startup.sh: 110: ./startup.sh: [[: not found
/usr/lib/jvm/java-8-oracle/bin/java  -server -Xms2g -Xmx2g -Xmn1g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m -XX:-OmitStackTraceInFastThrow -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/home/icvss-project/nacos/logs/java_heapdump.hprof -XX:-UseLargePages -Dnacos.member.list= -Djava.ext.dirs=/usr/lib/jvm/java-8-oracle/jre/lib/ext:/usr/lib/jvm/java-8-oracle/lib/ext -Xloggc:/home/icvss-project/nacos/logs/nacos_gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M -Dloader.path=/home/icvss-project/nacos/plugins/health,/home/icvss-project/nacos/plugins/cmdb -Dnacos.home=/home/icvss-project/nacos -jar /home/icvss-project/nacos/target/nacos-server.jar  --spring.config.location=classpath:/,classpath:/config/,file:./,file:./config/,file:/home/icvss-project/nacos/conf/ --logging.config=/home/icvss-project/nacos/conf/nacos-logback.xml --server.max-http-header-size=524288
./startup.sh: 131: ./startup.sh: [[: not found

Describe what you expected to happen

I expect Nacos is running in standalone mode and no more warning about [[: not found.

How to reproduce it (as minimally and precisely as possible)

  1. Just download the lastest binary release of Nacos
  2. running it under Ubuntu 14.04.2 TLS

Tell us your environment

Distributor ID: Ubuntu
Description: Ubuntu 14.04.2 LTS
Release: 14.04
Codename: trusty

nacos-server-1.3.1

Anything else we need to know?

N/A

@KomachiSion
Copy link
Collaborator

Please check your local startup.sh is same as distribution/bin/startup.sh.
If they are the same, please use sh startup.sh -m standalone again.

@KomachiSion KomachiSion added help wanted Extra attention is needed status/need feedback labels Jul 21, 2020
@JerryChin
Copy link
Contributor Author

@KomachiSion I've cross checked, there's no difference. The version is nacos-server-1.3.1, the lastest release.

using sh startup.sh -m standalone output the same result as I posted above.

I've found these two questions on Stackoverflow, the answers, if I understand correctly, suggest that [[ should always use with Bash shell or any shell with this extension, clearly this rules out the default shell specified in startup.sh viz. sh.

  1. https://stackoverflow.com/questions/13542832/difference-between-single-and-double-square-brackets-in-bash
  2. https://stackoverflow.com/questions/12230690/string-comparison-in-bash-not-found

@KomachiSion
Copy link
Collaborator

KomachiSion commented Jul 22, 2020

So should we change the top of startup.sh to #!/bin/bash will solve your problem?

@JerryChin
Copy link
Contributor Author

JerryChin commented Jul 22, 2020

@KomachiSion Yep. If you change shabang line to #!/bin/bash, everything will run smoothly.

Actually I think whoever wrote this script shoule be with bash in mind, but it still bothers me as to why the author didn't notice this problem.

The downside of using bash will be risky of non-portatability.

@KomachiSion KomachiSion added contribution welcome kind/bug Category issues or prs related to bug. and removed help wanted Extra attention is needed status/need feedback labels Jul 24, 2020
@roadToit
Copy link

roadToit commented Jul 29, 2020

bash startup.sh -m standalone,Ubuntu下用这个

@ljhrot
Copy link
Contributor

ljhrot commented Aug 2, 2020

@i will solve it@

@KomachiSion KomachiSion linked a pull request Aug 5, 2020 that will close this issue
5 tasks
KomachiSion added a commit that referenced this issue Aug 5, 2020
[ISSUE #3397]Fix shell syntax error when running in ubuntu
@fyeeme
Copy link

fyeeme commented Mar 7, 2022

use this on Ubuntu

bash startup.sh -m standalone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution welcome kind/bug Category issues or prs related to bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants