LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 10-11-2008, 10:29 AM   #1
nillgump
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}/*` &&
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 !
 
Old 10-11-2008, 11:09 AM   #2
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware-current, Cross Linux from Scratch, Gentoo
Posts: 2,705
Blog Entries: 1

Rep: Reputation: 220Reputation: 220Reputation: 220
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.

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


Reply


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


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

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