据我了解,bash是一个类似python交互式shell的程序,它通过输入流接收命令,通过调用Linux API函数执行命令,并将执行结果提供给输出流。
Terminal也是一个程序,为我们提供了一些功能,例如命令历史记录和突出显示,它在内部使用shell(bash)。
但是应用程序(例如Nautilus)是否使用/ bin / bash或使用其API与linux通信?
据我了解,bash是一个类似python交互式shell的程序,它通过输入流接收命令,通过调用Linux API函数执行命令,并将执行结果提供给输出流。
Terminal也是一个程序,为我们提供了一些功能,例如命令历史记录和突出显示,它在内部使用shell(bash)。
但是应用程序(例如Nautilus)是否使用/ bin / bash或使用其API与linux通信?
是的,程序可以显式地或隐式地使用外壳。
See e.g. Stéphane's answer to an unrelated question.
Their answer says, for example, that if the program uses the C library functions
execlp()
orexecvp()
to run a command, uponexecve()
returningENOEXEC
it will typically invokesh
on it ("it" being a shell script without an explicit interpreter specified, which is the context for that question).sh
is a shell.An application that uses
system()
to execute a utility will also typically invoke a shell.关于Nautilus,我不能说什么,但是如果它允许您执行任何类型的脚本,则很可能会使用Shell来执行。该应用程序的其余部分可能会使用GUI元素库,以及用于事件,文件系统操作等的其他库。这些库很可能是用C或类似语言编写的,并使用C库,其中一些库与操作系统内核接口对于某些操作。
我非常怀疑文件管理器本身是用任何一种Shell脚本语言编写的,尽管它很可能将Shell脚本用于启动或其他操作。