![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| String substitution on find results inside exec/xargs | myndcraft | Shell Programming and Scripting | 2 | 05-17-2008 02:36 PM |
| MV files with xargs or -exec | malaymaru | Shell Programming and Scripting | 4 | 04-28-2008 10:40 AM |
| Help with xargs | JimJim | UNIX for Dummies Questions & Answers | 4 | 02-08-2005 07:08 PM |
| xargs | jpprial | UNIX for Dummies Questions & Answers | 4 | 09-17-2001 08:29 PM |
| difference between source, exec and ./script | 98_1LE | UNIX for Dummies Questions & Answers | 1 | 04-15-2001 09:24 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Difference between xargs and exec
Hi,
I have tried both the options in small dummy scripts, but somehow i can't differentiate between the two. find . -name H* -exec ls -l {} \; find . -name H* | xargs ls -l Both work the ditto way. Any help is appreciated. |
|
|||||
|
Quote:
However the xargs solution will fail if the shell has trouble parsing the file names. Try: touch "stupid name" and then retry the two commands. There is a third solution that combines the best of both worlds. It is in Posix but not every version of the find command supports it. It's like the first syntax except that instead of \; you just use + to terminate the command. |
|
|||||
|
As Perderabo siad the + is a useful option if available, and is in POSIX but not implemented by all versions of find, most noticeably ( for a lot of people ) it is not found in the GNU version of find
from the GNU find man page: Code:
-exec command +
This variant of -exec is not yet supported, but is required by POSIX.
|
|
||||
|
Wow,
Just some small confusions. Your + option works for me. How can i found out whether my find is Gnu or not. I have tried "what find" - no use. "stupid name" fails in xargs, but its executing in exec Even if i do a "ls stupid name", it gives me error. I have to quote it, does exec automatically quotes it parameters. Thanks |
|
|||||
|
Quote:
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|