c - 在 Linux 中 "which source"什么都不返回?

标签 c linux shell system-calls

我想使用 exec()csource 一些 shell 脚本。

什么是source?是 二进制可执行文件 还是 shell 脚本?我在哪里可以在 Linux 文件系统中找到它?

我跑了

charan@PC-113:~$ which source 

charan@PC-113:~$

最佳答案

这是一个内置的 shell 命令,如 cdexitpwd...:

$ enable -p | grep source
enable source

请注意,enable -p 显示了所有内置函数。更多信息在 enable Man page .

更新

刚刚在 SuperUser 中看到一个非常有趣的线程:What does source do?

$ type source
source is a shell builtin

更新 2 - Tony D 评论

@SIGSEGV: sometimes a command can be implemented as an external (non-shell) executable, but some shells will still want to provide their own implementation... possibly with different behaviour, possibly just to make it faster. test and pwd are examples of this. For example, the shell can get its current working directory using getcwd(), but if it runs a separate executable without changing the current directory for that executable, and the executable runs getcwd() - it still works.

关于c - 在 Linux 中 "which source"什么都不返回?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17487514/

相关文章:

linux - 将子文件夹重命名为父文件夹,删除 'extra' 文件夹

c - 在C中逐行逐 block 地读取文件

c - 我怎样才能把不同的数字放在 C 上的 2 个数组中

linux - 交叉编译后,如何更改make install的源目录名称?

c - 使用 popen() 打开的文件描述符上的 pclose() 返回 errno 10(无子进程)

linux - 如何使用 while 循环仅读取特定模式的文件名

在 C 中读取标志和文件名的命令行参数

c - 用指针编译c代码时出现段错误

python - gtk python 网格调整大小

python - 在 python 中使用 sshpass 的 ssh 似乎不起作用