|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | 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 !! |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
About find
I have three question about find
1)regardless if it can "find" something or not, the "find" will return 0,how can we use "if" to judge not find or find? for example #find bin/ -name bla.c 1)find it will return 0 2) not found it will return 0 the question is how can I use "if" in the bash to judge it find or not 2)can we find in something specific directory(bin,/usr/bin) eg:I want find the bla.c only in the "bin" and "/usr/bin" 3)can we find something not in some directory(bin,/usr/bin) eg:I want find the bla.c not in the "bin" and "/usr/bin" Last edited by yanglei_fage; 07-10-2012 at 09:45 AM.. |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
> 1)regardless if it can "find" something or not, the "find" will return 0,how can
> we use "if" to judge not find or find? You need to be more specific on what you mean here. To find something or not something, just use grep > 2)can we find in something specific directory(bin,/usr/bin) Yes > 3)can we find something not in some directory(bin,/usr/bin) Again, you need to be more specific on what you mean here. To find something or not something, just use grep |
| Sponsored Links | ||
|
|
#3
|
||||
|
||||
|
1) You must be kidding... (ok - answer : Yes...)
2 and 3 are answered in the man pages... |
|
#4
|
|||
|
|||
|
Close this post
Thanks |
| Sponsored Links | |
|
|
#5
|
||||
|
||||
|
It doesn't work this way. You can't just open up another thread with the same questions when you are not satisfied with the answers here in hoping to get other or better answers.
It would be helpful if you maybe answer to the statements being made or rephrase your questions. |
| Sponsored Links | |
|
|
#6
|
||||
|
||||
|
Quote:
Code:
n12:/home/vbe $ find bin/ -name bla.c n12:/home/vbe $ # <- empty: nothing found n12:/home/vbe $ find bin/ -name prn bin/prn # found! dont confuse return code (exit value...) and what the command returns (result of the search using find...) |
| Sponsored Links | |
|
|
#7
|
||||
|
||||
|
Here is the case of return code that isnt 0: Code:
aco $ find ./home/oracle/.dt/Desktop -name toto;echo $? find: cannot open ./home/oracle/.dt/Desktop 1 Last edited by vbe; 07-10-2012 at 10:58 AM.. Reason: color... |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Find Failing on directory with spaces in directory name Find xargs sed errors. Find and replace. | sipeki | UNIX for Dummies Questions & Answers | 28 | 04-08-2012 05:35 PM |
| find: missing argument to `-exec' while redirecting using find in perl | ramkumarselvam | Shell Programming and Scripting | 2 | 12-16-2011 06:48 PM |
| Simplified find command to find multiple file types | vickramshetty | Linux | 2 | 05-28-2010 01:28 PM |
| how to find a file named vijay in a directory using find command | amirthraj_12 | UNIX for Dummies Questions & Answers | 6 | 10-25-2008 12:37 PM |
| command find returned bash: /usr/bin/find: Argument list too long | yacsil | Shell Programming and Scripting | 1 | 12-15-2003 05:38 PM |
|
|