Home > OS >  Turn to bash a great god, and want to know the rm * operation in the interpretation of the source in
Turn to bash a great god, and want to know the rm * operation in the interpretation of the source in

Time:04-23

In the process of the implementation of the rm *, the wildcard * is how to be explained? Here is my thought:
First of all, I'm in rm. C's main () to add the print, discovered before the execution/bin/rm, wildcard * has been interpreted as the current directory of all the files;
Secondly, I think the wildcard will explain in the Linux shell, but in the shell. The c in the main () also add print, found that when performing the rm * will not into the shell;
Then, I use the strace to see rm * process, found to be called directly execve () function, I don't see how to convert * to file name;
I think so, the process of monitoring by the strace bash, and then call the rm *, found some problems:
Through the above figure, I understand is openat () to read the current path of files and through getdents output to the buf, but shell is how to adjust? By
The readdir ()? Have a great god would specific description?



  • Related