简体   繁体   English

关于linux shell函数与C函数的关系()

[英]About the relation between linux shell's functions and C's functions()

For example, I thought the ln command in the shell is implemented by link() and symlink() provided by C,so I checked the src of the ln, but it seems it doesn't utilize them.例如,我认为shell中的ln命令是由C提供的link()和symlink()实现的,所以我检查了ln的src,但它似乎没有使用它们。

Yes, many Linux commands are written in C;是的,很多Linux命令都是用C写的; and many of those C programs might use C library functions like link() or symlink() .许多 C 程序可能使用 C 库函数,如link()symlink() Various Linux shells (eg sh, csh and bash) are themselves written in C, and also use C library calls.各种 Linux shell(例如 sh、csh 和 bash)本身是用 C 编写的,并且还使用 C 库调用。

HOWEVER...然而...

link() and symlink() are both POSIX-compliant wrapper functions, they're not part of the "Standard C Library". link() 和 symlink() 都是 POSIX 兼容的包装函数,它们不是“标准 C 库”的一部分。 Consequently, The "ln" command doesn't use them.因此,“ln”命令不使用它们。 See unistd.h for more details.有关更多详细信息,请参见unistd.h

See also What is included in the C standard library .另请参阅C 标准库中包含的内容

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM