Describe the bug
On Ubuntu/Debian systems, /bin/sh is symlinked to dash by default. The startup.sh script uses [[ bash syntax (e.g., line 172, 176, 184, 186, 193, 219, 232), which dash does not support. Running sh bin/startup.sh -m standalone results in multiple [[: not found errors, and the -m standalone parameter is not parsed correctly (Nacos starts in cluster mode instead).
Expected behavior
sh bin/startup.sh -m standalone should work correctly on Ubuntu/Debian, or the script should explicitly require bash.
Actual behavior
root1@root1-2288H-V5:~/nacos/nacos$ sh bin/startup.sh -m standalone
bin/startup.sh: 172: [[: not found
bin/startup.sh: 176: [[: not found
bin/startup.sh: 184: [[: not found
bin/startup.sh: 186: [[: not found
bin/startup.sh: 193: [[: not found
...
nacos is starting with cluster # -m standalone was ignored
How to Reproduce
Steps to reproduce the behavior:
- Use Ubuntu 22.04/24.04 (or any Debian-based system where
/bin/sh -> dash)
- Download and extract Nacos 3.2.1
- Run
sh bin/startup.sh -m standalone
- See
[[: not found errors and cluster mode startup
Environment
- OS: Ubuntu 22.04/24.04
- Nacos Version: 3.2.1
- JDK: 17
Suggested Fix
Option A: Change shebang from #!/bin/sh to #!/bin/bash
Option B: Replace all [[ ... ]] with POSIX-compatible [ ... ]
Additional context
Using bash bin/startup.sh -m standalone works as a workaround.
Describe the bug
On Ubuntu/Debian systems,
/bin/shis symlinked todashby default. Thestartup.shscript uses[[bash syntax (e.g., line 172, 176, 184, 186, 193, 219, 232), whichdashdoes not support. Runningsh bin/startup.sh -m standaloneresults in multiple[[: not founderrors, and the-m standaloneparameter is not parsed correctly (Nacos starts in cluster mode instead).Expected behavior
sh bin/startup.sh -m standaloneshould work correctly on Ubuntu/Debian, or the script should explicitly requirebash.Actual behavior
How to Reproduce
Steps to reproduce the behavior:
/bin/sh->dash)sh bin/startup.sh -m standalone[[: not founderrors and cluster mode startupEnvironment
Suggested Fix
Option A: Change shebang from
#!/bin/shto#!/bin/bashOption B: Replace all
[[ ... ]]with POSIX-compatible[ ... ]Additional context
Using
bash bin/startup.sh -m standaloneworks as a workaround.