in reply to Re: determing a binary file
in thread determing a binary file

The -B file test operator makes it's best guess based on the file contents which in the absence of other contextual information (extensions, metatags, etc) is the best one can do to determine filetype. In theory all files are binary files and a (usually) better question to ask is whether a file is (not) a text file and therefore whether or not you can use tools with text-based assumptions on it. The only way to fully determine this is to read the entire file and test its contents against your assumptions. In practice though most programs either rely on meta-information, user input, or so-called "magic numbers" in certain filetypes.