如何在魔术文件中搜索扩展名
问题描述:
我知道您可以使用
file *.myext
但是我想知道是否可以在我的魔术文件中写入一行,例如在所有".42" ex上返回成功消息:myfile.42
But I'm wondering if I can write into my magic file a line which for example return a success message on all the ".42" ex : myfile.42
想象一个包含以下文件的文件夹
imagine a folder with the following files
- test1.42
- test2.kk
- test3.42
我的魔术文件的内容应该是什么,以便仅在test1.42和test2.42上获得成功
what should be the content of my magic file in order to make a success only on test1.42 and test2.42
我暂时尝试过
>0xA2 string 42 success
答
linux/unix并不关心文件扩展名,魔术数字表示文件的第一个字节,用于确定文件的类型.
linux/unix doesn't care about filename extensions, magic numbers represents first bytes of file which are used to determine type of file.