1828245 Members
2699 Online
109975 Solutions
New Discussion

find question

 
SOLVED
Go to solution
Ionut Grigorescu_2
Super Advisor

find question

Hi all,

when I'm running find as a normal user in csh I get the error message:
find: cannot open xxxx
find / -name filename -print 2>/dev/null returns me the error:
missing conjunction
any idea?
If it weren't for STRESS I'd have no energy at all
15 REPLIES 15
curt larson_1
Honored Contributor

Re: find question

qoute your wildcard characters
Pete Randall
Outstanding Contributor

Re: find question

Ionut,

Interesting - I just tried it with ksh and got no errors.


Pete


Pete
Pete Randall
Outstanding Contributor

Re: find question

Ionut,

Actually, I just switched to csh and got no errors, either. Strange!


Pete


Pete
Justo Exposito
Esteemed Contributor

Re: find question

Hi,

Put:

find / -name "filename" -print
or
find / -name 'filename' -print

Regards,
Justo.
Help is a Beatiful word
John Palmer
Honored Contributor

Re: find question

Hi,

It sounds as though you are including wildcard characters (? or *) in filename.

When you do that you either have to quote the whole string, something like:

find . -name "wild*card"

or 'quote' the wildcard character:

find . -name wild\*card

Regar
John Palmer
Honored Contributor

Re: find question

Hi,

It sounds as though you are including wildcard characters (? or *) in filename.

When you do that you either have to quote the whole string, something like:

find . -name "wild*card"

or 'quote' the wildcard character:

find . -name wild\*card

Regards,
John
Helen French
Honored Contributor

Re: find question

Missing conjunction error normally appears when you specify -name option without a quot:

# find ..options ...-name 'filename' -print
Life is a promise, fulfill it!
Tim D Fulford
Honored Contributor

Re: find question

One or more thinks may be confusing the issue/wrong!!

1 - You MUST be using ksh or sh otherwise the 2>/dev/null will fail. If you are using csh or tcsh then 2>/dev/null will not help (no such thing as std err in C-shell)
2 - No need for the -print, but it will not hurt
3 - put a backslash before wild cards

Regards

Tim
-
Ionut Grigorescu_2
Super Advisor

Re: find question

It doesn' work!! On all machines I have tried is the same. I always re-direct the output to a file I delete after, cause I cannot get rid of the cannot open xxxx messages. with ksh is ok but in csh is always the same problem!
If it weren't for STRESS I'd have no energy at all
Tim D Fulford
Honored Contributor

Re: find question

cannot oper xxxx means no permissions on that dir...

Tim
-
Pete Randall
Outstanding Contributor

Re: find question

Ionut,

How about a work-around then:

find / -name filename -print |grep -v 'cannot'


Pete


Pete
Pete Randall
Outstanding Contributor

Re: find question

Ionut,

Disregard, that doen't work.


Pete


Pete
john korterman
Honored Contributor

Re: find question

Hi,
as already said, C-shell does not have any redirection control of standard error. Hence C-shell does not understand the "2>"??; it believes this to be an option to the "find" command.
I think it will correspond this in sh:
# find . -name plut -print 2
which will produce a similar error message.

regards,
John K.
it would be nice if you always got a second chance
Michael Kelly_5
Valued Contributor
Solution

Re: find question

Ionut,
run your find command in a subshell like this:
(find / -name filename >`tty`) >&/dev/null

HTH,
Michael.
The nice thing about computers is that they do exactly what you tell them. The problem with computers is that they do EXACTLY what you tell them.
Ionut Grigorescu_2
Super Advisor

Re: find question

Thanx a lot Michael - that was the right one!
case closed
If it weren't for STRESS I'd have no energy at all