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

Viewed 76

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.

1 Answers

Yes, many Linux commands are written in C; and many of those C programs might use C library functions like link() or symlink(). Various Linux shells (e.g. sh, csh and bash) are themselves written in C, and also use C library calls.

HOWEVER...

link() and symlink() are both POSIX-compliant wrapper functions, they're not part of the "Standard C Library". Consequently, The "ln" command doesn't use them. See unistd.h for more details.

See also What is included in the C standard library.

Related