This forum has been archived. All content is frozen. Please use KDE Discuss instead.

How to add media type / MIME type based on shebang?

Tags: None
(comma "," separated)
achim
Registered Member
Posts
8
Karma
0
Hi,

I use fish as my shell and sometimes I write a script. This is when I noticed something peculiar:
A shell script does not require a file extension of .sh to be recognized as a script. It is sufficient to have a shegang in the file that points to the shell:
#!/bin/sh
The same goes for zsh or ksh:
#!/bin/zsh
#!/bin/ksh
Having a script without file extension but with one of those shebang lines will be recognized as "Shell-Script" media type. As such, these files also display as scripts in dolphin.

But when I use a shebang that points to fish, it is not recognized as script. It is always displayed as plain text file. And it is opened in my text editor instead of being executed.
So my question is, where is this configured and why is a file with a shebang that points to fish not recognized as a script although the others are?

Adding media types in KDE is only possible using file extensions, right?
airdrik
Registered Member
Posts
1854
Karma
5
OS
I believe the file manager pays attention to the Executable flag on the file (right click on the file -> Properties -> Permissions, or a simple "chmod +x myFishScript"). If the file has the Executable flag set then clicking on it will attempt to run it (which should use the shebang line to figure out how).


airdrik, proud to be a member of KDE forums since 2008-Dec.


Bookmarks



Who is online

Registered users: Bing [Bot], daret, Google [Bot], sandyvee, Sogou [Bot]