While I'm reading file(1) I noticed this in the man page (emphasis mine):

When adding local definitions to /etc/magic, make sure to preserve these keywords. Users depend on knowing that all the readable files in a directory have the word “text” printed. Don't do as Berkeley did and change “shell commands text” to “shell script”.

What's the story behind this sentence? I guess Berkeley refers to BSD (Berkeley software distribution) but Google didn't give enough information about this.

Link to file(1) http://man7.org/linux/man-pages/man1/file.1.html

Some digging around shows that this statement was added 27 years ago link

Don't do as one computer vendor did \- change ``shell commands text''
to ``shell script''.

and later changed to current statement link

Don't do as Berkeley did \- change ``shell commands text''

People had been writing scripts (and possibly C programs) to run file on a file, capturing the output with $(file foobar) or popen(), and doing a string match check to see whether the output from file contained (or ended with) the word “text”.  Then the developers of the Berkeley Software Distribution (at the University of California, Berkeley) did as described and caused all those scripts and programs not to recognize shell script files as text files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.