Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 如何检查文件是否是nim中的可执行文件?_Linux_Executable_Nim Lang - Fatal编程技术网

Linux 如何检查文件是否是nim中的可执行文件?

Linux 如何检查文件是否是nim中的可执行文件?,linux,executable,nim-lang,Linux,Executable,Nim Lang,如何使用Nim检查文件是否是Linux上的可执行文件? 提前感谢。您可以使用并检查它返回的集合中是否有某个 import os let isExecutable = fpOthersExec in getFilePermissions "./filename" 您可能需要检查三种不同的Exec变体是否都在其中: import os proc isExecutable(filename: string): bool = let filePermissions = getFilePermi

如何使用Nim检查文件是否是Linux上的可执行文件? 提前感谢。

您可以使用并检查它返回的集合中是否有某个

import os

let isExecutable = fpOthersExec in getFilePermissions "./filename"
您可能需要检查三种不同的Exec变体是否都在其中:

import os

proc isExecutable(filename: string): bool =
  let filePermissions = getFilePermissions filename
  fpUserExec in filePermissions and
    fpGroupExec in filePermissions and
      fpOthersExec in filePermissions