Divine Journey 2

Divine Journey 2

636k Downloads

Running launch.sh fails with "Bad substitution"

tabasavr opened this issue ยท 1 comments

commented

Modpack version

2.21.1

Description

Running launch.sh on Ubuntu 24.04.1 fails with error message
./launch.sh: 21: Bad substitution

Steps to reproduce

  1. Install server on Ubuntu. Make launch.sh executable: chmod +x launch.sh.
  2. Run it with ./launch.sh
  3. See error message in terminal: ./launch.sh: 21: Bad substitution

Expected behavior

Server starts normally

Additional context

This should happen in other Linux distros too, but I haven't tested it.

The reason this happens is shebang is /bin/sh so the script runs with sh instead of bash. In my testing it supports neither the quote stripping syntax nor the declare keyword.

A possible fix is to replace the shebang with #!/usr/bin/env bash so it always runs with bash. autolaunch.sh already uses bash shebang, though this one is "superior".

Your Divine Journey 2 Discord Username

tabasavr

commented

its definitely unintended that those are different.
your issue is going to be specific to Debian/Ubuntu and any others in the family that have their default sh set to dash. most places have it set to bash as the default, and bash is the default for me so i hadnt realized that what i was writing might not work elsewhere. (hey, works on my machine!)
will switch it to not use bash exclusive features and set it to use sh for both for portability if possible, otherwise will set to bash.