Missing something small....


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Missing something small....
# 1  
Old 06-16-2009
Missing something small....

I have a feeling my eyes are burned and I am just missing something small here but can somebody tell me why this is not working....
Code:
#!/bin/ksh
Trunk_Path=/lcl/sit/apps/Tivoli
types="-name '*.sh' -o -name '*.conf' -o -name '*.rules' -o -name '*.dat' -o -name '*.props' -o -name '*.sql' -o -name '.pl'"
find $Trunk_Path/casd -type f $types

When I execute it nothing is returned. Yet I can execute the exact same code by hand from a prompt and I get 3 results of files found.

Any ideas?
# 2  
Old 06-16-2009
Missing parentheses. See "man find".

Code:
types="-name '*.sh' ( -o -name '*.conf' -o -name '*.rules' -o -name '*.dat' -o -name '*.props' -o -name '*.sql' -o -name '.pl )'"

# 3  
Old 06-16-2009
Thanks for the tip.... Well I gave it a try....
Code:
#!/bin/ksh
Trunk_Path=/lcl/sit/apps/Tivoli
types="-name '*.sh' ( -o -name '*.conf' -o -name '*.rules' -o -name '*.dat' -o -name '*.props' -o -name '*.sql' -o -name '.pl )'"
find $Trunk_Path/casd -type f $types

However it did not work.... Here are the results....
Code:
find: bad option )'
find: [-H | -L] path-list predicate-list

So I started looking here....
http://unixhelp.ed.ac.uk/CGI/man-cgi?find

But I still do not see what is wrong.

-----Post Update-----

I also tried it this way....
Code:
types="-name '*.sh' ( -o -name '*.conf' -o -name '*.rules' -o -name '*.dat' -o -name '*.props' -o -name '*.sql' -o -name '.pl' )"

Still no results.

Last edited by LRoberts; 06-16-2009 at 10:03 AM..
# 4  
Old 06-16-2009
methyl ,

Code:
I dont think so , it's solves the problem. When i tested your solution , it's bounded back with error :

find: bad option -o

# 5  
Old 06-16-2009
When I do it this way....
Code:
types="-name '*.sh' ( -o -name '*.conf' -o -name '*.rules' -o -name '*.dat' -o -name '*.props' -o -name '*.sql' -o -name '.pl' )"

I get no errors however it does not return any files either which are there.
# 6  
Old 06-16-2009
Code:
types="\( -name '*.sh' -o -name '*.conf' -o -name '*.rules' -o -name '*.dat' -o -name '*.props' -o -name '*.sql' -o -name '*.pl' \)"

# 7  
Old 06-16-2009
This isn't something small it is serious ... the variable "types" contains many arguments not one so it has to be a matrix... so do the following extra steps and it will work...



Code:
set -A types  #if this didn't work 


Trunk_Path=/lcl/sit/apps/Tivoli
types="-name '*.sh' -o -name '*.conf' -o -name '*.rules' -o -name '*.dat' -o -name '*.props' -o -name '*.sql' -o -name '.pl'"


find $Trunk_Path/casd -type f  "${types[@]}"

In bash which is easier:

Code:
declare -a types=(-name '*.sh' -o -name '*.conf' -o -name '*.rules' -o -name '*.dat' -o -name '*.props' -o -name '*.sql' -o -name '.pl' )

find $Trunk_Path/casd -type f  "${types[@]}"

I test the bash script it worked but didn't test the ksh script ...

BR
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Yum - resolving missing dependencies that are not missing

I am trying to install VirtualBox on RHEL 5 but I need the 32 bit version for 32 bit Windows. When I run yum I get the following: sudo yum localinstall /auto/spvtg-it/spvss-migration/Software/VirtualBox-4.3-4.3.2_90405_el6-1.i686.rpm Loaded plugins: fastestmirror Setting up Local Package... (13 Replies)
Discussion started by: gw1500se
13 Replies

2. SuSE

How to resolve missing missing dependencies with opensuse 11.3 and 12.3?

Hello, This is a programming question as well as a suse question, so let me know if you think I should post this in programming. I have an application that I compiled under opensuse 12.2 using g77-3.3/g++3.3. The program compiles and runs just fine. I gave the application to a colleague who... (2 Replies)
Discussion started by: LMHmedchem
2 Replies

3. Programming

Need Help in Small Project

I need help with a small project that I am doing for my client. My clients have a company that does staffing for hotel workers and when they sign up with him, they have to watch 4 separate training videos. What I need help with is a script of some sort that will pop-up a sign in box of some sort... (2 Replies)
Discussion started by: AimyThomas
2 Replies

4. Shell Programming and Scripting

need a small help

Hi, sorry for inconvenience..wrong query posted. Thanks for your help. Thanks (1 Reply)
Discussion started by: kirankumar
1 Replies

5. UNIX for Dummies Questions & Answers

need help with small script

Hi I have the below file Name=abc Yr=2011 Mon=05 My script should be in such a way that whenever I run it then Month should increment by 1 and if the month is 12 then when I run the script then year should incremented by 1 and month Should become 01(I.e jan) Thanks for the help in... (6 Replies)
Discussion started by: kishu
6 Replies

6. Shell Programming and Scripting

Need small help

Hi all, I have two files in my folder 1.index.jsp 2.maintenance.jsp Once hit the URL in IE,It will call the index.jsp file than application working fine. I want to some maintenance in my application, during the application maintenance than it will... (1 Reply)
Discussion started by: lkeswar
1 Replies

7. Shell Programming and Scripting

Need small help

Hi, i have a client requirement to post the files into generic folder named as "source".file identification is to retrieve Publication code (Instance name) from the file name.So thereafter we move the files to different instances of specific folders for the same unix server.(means if the file... (2 Replies)
Discussion started by: kirankumar
2 Replies

8. UNIX for Advanced & Expert Users

Two small queries

Query 1 : How to check if a directory already exists? If doesn't exist then create a new one. Query 2 : I want to put following text using a single echo statement into a log file and also want to retain the formatting of the text. How it can be... (3 Replies)
Discussion started by: skyineyes
3 Replies

9. OS X (Apple)

Ok another small thing if anyone knows...

Hi i wanna change the look of my terminal. For example i wanted a black background and like a cyan colored text so it stands out against the black. Is there anyway i can do this?. I am running Mac OSX if that helps any at all (2 Replies)
Discussion started by: Corrail
2 Replies

10. Shell Programming and Scripting

Need help in a small script

Hi all, I have a file of the following format - EXPRPT:SCN:1.1706E+10:SEQ_START:121652:SEQ_END:121664:0 ( This file name is variable and changes daily) Now in the same directory I have another set of files of the format - EXPRPT.log.0001.0000121669 Now what I am trying to do is to ... (2 Replies)
Discussion started by: super_duper_guy
2 Replies
Login or Register to Ask a Question