![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Reg: Search for a directory | Rajanikanth | Linux | 1 | 01-08-2008 04:06 AM |
| Reg: Search for a directory | Rajanikanth | UNIX for Dummies Questions & Answers | 1 | 01-07-2008 03:36 AM |
| Reg: Search for a directory | Rajanikanth | Shell Programming and Scripting | 0 | 01-07-2008 03:30 AM |
| Reg: Search for a directory | Rajanikanth | UNIX for Advanced & Expert Users | 0 | 01-07-2008 03:28 AM |
| Directory tree search??? | solvman | High Level Programming | 3 | 09-28-2001 10:27 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Reg: Search for a directory
Dear All,
I am new to Unix and i need a small Help from you Guys..... The current structure of my system is as follows: /Abc/xyz/cpd/std/re/doc Each cpd directory has n number of std's. Each std has n number of re's. My requirement is to write a UNIX script that would search whether doc directory is present under all re's directories. If it is not, i need to write it into a temp file with the full path /Abc/xyz/cpd/std/re/doc. Can anyone of you help me in writing a UNIX script for the above mentioned requirement ASAP. Looking forward to your response. Thank You. Regards, Rajani-kanth. |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Code:
for dir in /Abc/xyz/cpd/*/* ; do if [ ! -d $dir/doc ]; then echo $dir >> /tmp/tempfile.txt ; fi ; done |
|
#3
|
|||
|
|||
|
i have done changes to the script according to my requirement but sorry to say that it's not working...........
|
|
#4
|
||||
|
||||
|
Quote:
What shell are you using? The above code is for any bourne-style shell - ie it won't working under csh or tcsh |
|
#5
|
|||
|
|||
|
Hi ...
Thanks for your help.....and we are using : /bsh i have saved the file with name : test1.sh after compiling with : ./test1.sh it si showing nothing...so i have checked for the file under :/abc/xyz//tem/tempfile.txt but i was not able to find it. Regards, Rajanikanth. |
|
#6
|
||||
|
||||
|
Quote:
Are you seeing any errors output at all? If you've modified it, perhaps posting the new version might help us find what's wrong. As a quick method of debugging, I'd also suggest removing the '>> /tmp/tempfile.txt' part so you can see what it's doing more easily. |
|
#7
|
|||
|
|||
|
Code:
# find /Abc/xyz/cpd*/std*/re* ! -name "doc" > temp |
|||
| Google The UNIX and Linux Forums |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|