So when I run
./install.sh
it should be processed by bash, right?
Indeed. That's exactly what the shebang is for.
Troubleshooting
Save the following as
test.sh
and try to run it from fish.#!/bin/bash true && true
It works on my computer, and it should on yours.
Check if the first line of
install.sh
contains only the characters#!/bin/bash
.Invisible characters (such as a CR linebreak) could confuse fish.
Run
/bin/bash --version
to check that bash is actually bash and hasn't been accidentially replaced/modified over time.
install.sh
$SRC_USER
is just a synonym the script creates for $SUDO_USER
.
As a result, when the script is run with root privileges, the command
su $ -c "sed -imod \"s|Exec=.*|Exec=$|\" $ && rm -rf $mod"
automatically uses the sudo user's default shell, which is fish.
To override this default, add the instruction -s /bin/bash
to the su
command.