Re Dolphin, the preference you want is under General/Confirmation - at the bottom you have ‘When opening an executable file:’.
It only makes sense to open a file from Dolphin (or any file manager) if the script doesn’t run and terminate - if it does run and terminate, you won’t see any output and won’t know whether it’s run correctly (or at all!). When you can sensibly run it Dolphin is when it does something like opening a program for displaying a file.
To make sense of why you need to cd to the directory before you can run your script, you need to read up a bit about absolute and relative paths, such as:
You can google for more details.
So you can run /home/joe/Documents/test.sh or ~/Documents/test.sh, or go to the directory and use ./test.sh
Notice that this last (./test.sh) is using the dot (not a comma) to mean the current directory.
If you’re in /home/joe/Documents can also do things like listing /home/joe by using:
ls -l ..
(where the two dots mean the parent directory)
You should be aware that (unlike Windows), the path ($PATH) does not (by default) include the current directory, hence the need for the ./
There’s an awful lot you can do with bash (which is the name of the shell your script is written in). The documentation is here:
Don’t worry if most of it doesn’t make sense, but bits might be helpful if you write a script that doesn’t work.