Closed VirtualJunky closed 3 years ago
Thanks @VirtualJunky I had the same problem. Also thanks a lot to @T-Grave for this!
How did you execute the script? I've only executed it with sh install.sh
. I didn't checked ./install.sh
. I did sh install.sh
because not everyone has bash as its default shell. If I am wrong, I can change this line. @T-Grave what do you say?
@lm41 I used chmod +x install.sh
because it gave me a no access error otherwise, then simply install.sh
and it ran until reboot. I'm using Pop!_OS if that helps any, as said brand new to Linux so unfamiliar with what shell I have, but it would be the same on Ubuntu I believe. Heck, not even sure the difference between sh or bash is quite yet. :)
Can you try to execute the original script via sh install.sh
?
@VirtualJunky You can type ps -p $$
to get the current shell.
@lm41
Here's using sh install.sh
: https://i.gyazo.com/d61162744ecd1cb2e044e16e2ea0c470.png
Also tried bash install.sh
: https://i.gyazo.com/769a1a22811ce0b37c3e31e1859c3f01.png
Both tests on a completely fresh version of Pop!_OS, haven't touched a single setting or installed anything. Didn't see the other comment until I was already swapped back to my main OS.
@VirtualJunky but the bash install.sh
did work?
The install.sh script contains "bashisms", making it dependent on bash to execute it.
The error @VirtualJunky and myself run into is due to the shebang on the first line: it's interpreted as a directive, making the script actually being executed with the shell interpreted defined in the shebang, if the script is launched "naked" from the comandline (ie ./install.sh
).
It works using bash ./install.sh
because in that case, the shebang is ignored and the script is directly executed by bash.
To fix this, I see two options:
!#/bin/sh
will always work. That would eliminate the requirement of bash.!#/bin/bash
. This will maintain the current requirement of having bash installed.@lm41 if you prefer the first option, this utility can help locating all the bashism in the script checkbashisms.
IMHO, it would be easy to eliminate the bashisms and hence the need to have bash installed.
Hope this helps.
I have checked the scripts against checkbashisms
. configure_goxlr.sh
and configure_goxlr_mini.sh
are OK. install.sh
has 4 "issues" to fix, but all 4 are the same (the format of the if condition):
checkbashisms install.sh
possible bashism in install.sh line 14 (alternative test command ([[ foo ]] should be [ foo ])):
if [[ ! -z $APT_GET_CMD ]]; then
possible bashism in install.sh line 17 (alternative test command ([[ foo ]] should be [ foo ])):
if [[ "$1" = "MINI" ]]; then
possible bashism in install.sh line 23 (alternative test command ([[ foo ]] should be [ foo ])):
elif [[ ! -z $PACMAN_CMD ]]; then
possible bashism in install.sh line 26 (alternative test command ([[ foo ]] should be [ foo ])):
if [[ "$1" = "MINI" ]]; then
Ok, I fix this
In #16 these issues should be resolved.
New to Linux so maybe I did something wrong here, but I was getting this error for line 14 and 23 "[[: not found" and after a Google found that I needed to change the first line from "#!/bin/sh" to "#!/bin/bash". Would PR it but as said, brand spankin new to Linux here so maybe I'm in the wrong, but figured I would mention it.
Thanks for the awesome work on this so far, been the only thing holding me back switching or at least trying Linux!