Dê uma olhada na página man do comando file
:
$ man file
...
file tests each argument in an attempt to classify it. There are three sets of tests, performed in this order: filesystem tests, magic tests, and language tests. The first test that succeeds causes the file type to be printed.
É o terceiro teste ( testes de idioma ) que o file
realiza categorizando esse arquivo como um arquivo C ++.
Once file has determined the character set used in a text-type file, it will attempt to determine in what language the file is written. The language tests look for particular strings (cf. #include ) that can appear anywhere in the first few blocks of a file. For example, the keyword .br indicates that the file is most likely a troff(1) input file, just as the keyword struct indicates a C program. These tests are less reliable than the previous two groups, so they are performed last. The language test routines also test for some miscellany (such as tar(1) archives).
Os arquivos c # são mais parecidos com os arquivos C ++ e, portanto, file
"adivinha" que o arquivo .cs é um arquivo C ++.
Exemplo
$ more blah.cs
// A Hello World! program in C#.
using System;
namespace HelloWorld
{
class Hello
{
static void Main()
{
Console.WriteLine("Hello World!");
// Keep the console window open in debug mode.
Console.WriteLine("Press any key to exit.");
Console.ReadKey();
}
}
}
Verificação com file
:
$ file blah.cs
blah.cs: ASCII C++ program text