I was making this bash install script on ubuntu 21.10. I was going to test out the first little bit, but I ran into this error.

/tmp/geany_run_script_GBYCG1.sh: 7: ./install sauerbraten 2020: Permission denied

(program exited with code: 126)
Press return to continue

This is the script so far.


DIRECTORY="$(dirname "$(dirname "$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )")")"

function error {
  echo -e "\\e[91m$1\\e[39m"
  exit 1

wget https://sourceforge.net/projects/sauerbraten/files/sauerbraten/2020_11_29/sauerbraten_2020_12_29_linux.tar.bz2/download

#tar -xf

What is wrong, and how can I fix it?

  • The DIRECTORY= line is completely bonkers. I can't even understand what you're trying to achieve there. And it has too many quote signs. Quote signs are not like parenthesis - every pair of consecutive quotes are closing one string between them. So for instance, your second quotes are closing the first quotes, they don't start a new pair (like I think that you think they should do). But again, I'm having trouble to follow what you're even trying to do.
    – aviro
    Jan 18, 2022 at 21:29
  • 2
    @aviro Double quotes inside $(...) are parsed separately from those outside. So the OP is hoping that $0 reflects the path to the current script. The innermost $(..) prints the "physical" location of the script, and the each of the other two $(..) go up one directory level.
    – icarus
    Jan 18, 2022 at 21:41
  • 2
    @aviro, actually, with the command substitutions there, they do need the quotes on each level. It's not that the quotes nest like parentheses, but the command substitutions do, and the quotes inside and outside the command substitution are independent. See e.g. unix.stackexchange.com/q/443989/170373
    – ilkkachu
    Jan 18, 2022 at 21:42
  • @ilkkachu the error is not from the posted script I think - it's from a kind of wrapper script that geany is creating on-the-fly to execute it. Probably the OP needs to configure a geany "build" command for shell scripts Jan 18, 2022 at 22:26
  • 1
    @ilkkachu yeah I just had a play with geany on my box to confirm Jan 18, 2022 at 22:59

1 Answer 1


The error is not from your bash script, it's from the shell wrapper script that Geany uses to execute your file (when you press F5 or select the Build -> Execute menu item).

The default Geany Execute action is "./%f" which takes the name of your file and wraps it in a script in /tmp like


rm $0

cd '/home/username'

"./name of your file"

echo "

(program exited with code: $?)"

echo "Press return to continue"
#to be more compatible with shells like dash
read dummy_var

The error is coming from Line 7 of this script, i.e.

"./name of your file"

and is simply indicating that file ./install sauerbraten 2020 cannot be executed because of its permission bits - likely the executable bit is not set for your user. You can fix it with

chmod +x "./install sauerbraten 2020"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .