SUMMARY If try to execute a .sh script with dolphin, it will try to execute it as a binary, failing to do anything. STEPS TO REPRODUCE 1. Create a .sh text file that would do something simple, such as `touch deleteme`. 2. Set the file as executable. 3. Click (or double click) said file in dolphin and choose to execute it. OBSERVED RESULT Fails to execute it, tries to execute as if it were a binary file. EXPECTED RESULT Should execute the shell script. SOFTWARE/OS VERSIONS Windows: macOS: Linux/KDE Plasma: (available in About System) KDE Plasma Version: 5.20.4 KDE Frameworks Version: 5.77.0 Qt Version: 5.15.2 ADDITIONAL INFORMATION
Does it start with the shebang?
(In reply to Christoph Feck from comment #1) > Does it start with the shebang? It does work when I add it. Although I'd also expect it to use the defaults if it's missing it, provided it's a .sh file.
*** Bug 431244 has been marked as a duplicate of this bug. ***
I suppose KIO could detect this from the file extension.
I think this is not a bug, you should add a proper shebang to a shell script.
(In reply to Ahmad Samir from comment #5) > I think this is not a bug, you should add a proper shebang to a shell script. Running 'sh file.sh' does not require a shebang. Neither does the software which gets the mimetypes.
It may not technically require it, but it's good practice, precisely to avoid these kinds of issues. Just add the shebang. :)
(In reply to David from comment #6) > Running 'sh file.sh' does not require a shebang. [...] You run `sh file.sh` from terminal, using a shell, bash, zsh...etc; but KProcess/QProcess doesn't know that, and without that info the system call it'll use fails, IIUC.
(In reply to Ahmad Samir from comment #8) > (In reply to David from comment #6) > > Running 'sh file.sh' does not require a shebang. > [...] > You run `sh file.sh` from terminal, using a shell, bash, zsh...etc; but > KProcess/QProcess doesn't know that, and without that info the system call > it'll use fails, IIUC. It'd then be helpful to at least show a message to the user that it needs a shebang, instead of tying to execute it as a binary. I assume it already has the mimetype information when it attemps to run it.
That's a good point, reopening (I don't know how feasible it is to actually detect the lack of shebang beforehand, but it's worth investigating).
*** Bug 455551 has been marked as a duplicate of this bug. ***