Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.


  Search this Thread
Old 10-11-2008, 10:29 AM   #1
LQ Newbie
Registered: Oct 2008
Posts: 7

Rep: Reputation: 0
Question 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}/*` &&

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

especially the \;

and what is the differeces between && and /?

Thank you !
Old 10-11-2008, 11:09 AM   #2
ReliaFree Maintainer
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware-current, Cross Linux from Scratch, Gentoo
Posts: 2,812
Blog Entries: 1

Rep: Reputation: 259Reputation: 259Reputation: 259
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
-xtype d
But not entering those subdirectories
-maxdepth 0
For any subdirectories found you're removing them
-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.

Last edited by weibullguy; 10-11-2008 at 11:11 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Semaphore-like shell code omnio Programming 13 03-12-2007 03:36 AM
Can someone explain to me this code from K&R's 'The C Programming Language' book? frankie_DJ Programming 10 11-25-2006 01:35 PM
explain me some c code alaios Programming 4 11-28-2005 11:27 AM
explain me this c code plz alaios Programming 1 06-03-2005 05:32 AM
c code vs shell script again? khucinx Programming 1 05-12-2004 09:44 PM > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 09:08 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration