>> Some more questions. Is it possible to recognise an html file by a couple of >> magic numbers at the beginning? Most html starts <html> or <HTML>, but it is >> not certian that it will look like this. Another thought is the possiblilty >> of >> running perl scripts without the bang path, but then how would the shell tell >> it is a perl script. > >Uh, for SGML documents, how about looking at the <!doctype ...> ? > >Anyway, I suggested even to use the file utility, so you can make use of the >magic database.
This is getting a bit off the original thread... IMHO, any magic type of database, is a "hacked" solution. What I really would like is a filesystem that can store a mime-type for every file... That way no magic databases are required. In addition, the kernel could be configured to assign default mime-types for different file extensions, or something. This would mean instead of having lots of different programs trying to determine file types (each with a very different method - some use extensions, others use magic databases or a combination of the two). Programs like Apache wouldn't have to work out the mime type from the extension, but could just look at the value given by the filesystem. Changing the mime-type for one file would automatically effect all programs. [ runs for cover... ] -- Brian May <[EMAIL PROTECTED]>