Hi all, I'm trying to understand how file(1) behaves, when there are multiple matches, but I'm not skilled enough to understand the source code and the man page describes a different behaviour than what I'm seeing. man file(1) says "The first test which succeeds causes the file type to be printed.", however, this does not seem to be true:
$ cat ~/.magic 0 string foo foo file 0 string foor foor file $ cat foo foor $ file foo foo: foor file $ vim ~/.magic && cat ~/.magic 0 string foor foor file 0 string foo foo file $ file foo foo: foor file Have I misunderstood the definition of "The first test"? I assumed this meant "the test with the lowest line number". Is this the expected behaviour? It seems to me like others misunderstood this before me; for example: With the default magic-file (/etc/magic), I cannot get this line's message to be printed: 0 search/1 #!/usr/bin/env\ lua Lua script text executable Instead this happens: $ cat foo
$ file foo foo: a lua script text executable Which seems to be the result of this test: 0 string #!/usr/bin/env a >15 string >\0 %s script text executable Greetings, Richard Ulmer