LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   help to explain the shell code ! (https://www.linuxquestions.org/questions/linux-from-scratch-13/help-to-explain-the-shell-code-675687/)

nillgump 10-11-2008 10:29 AM

help to explain the shell code !
 
GCC_INCLUDEDIR=`dirname $(gcc -print-libgcc-file-name)`/include &&
find ${GCC_INCLUDEDIR}/* -maxdepth 0 -xtype d -exec rm -rvf '{}' \; &&
rm -vf `grep -l "DO NOT EDIT THIS FILE" ${GCC_INCLUDEDIR}/*` &&
unset GCC_INCLUDEDIR


the above code are from LFS BOOK.
I cann't understand the red line .
this:
find ${GCC_INCLUDEDIR}/* -maxdepth 0 -xtype d -exec rm -rvf '{}' \; &&

especially the \;


and what is the differeces between && and /?

Thank you !

weibullguy 10-11-2008 11:09 AM

Try reading the man page for find.

First you're finding the directory with gcc headers. Then you're looking in that directory for subdirectories
Code:

-xtype d
But not entering those subdirectories
Code:

-maxdepth 0
For any subdirectories found you're removing them
Code:

-exec rm -rvf '{}' \;
&& means continue with the next command if the previous command exits with code 0 (i.e., successfully). The / depends on context. In this case, it is the path separator.


All times are GMT -5. The time now is 08:56 AM.