Operating System - HP-UX
1830899 Members
3446 Online
110017 Solutions
New Discussion

find: missing conjunction

 
ikbea
Frequent Advisor

find: missing conjunction

Hi all,

Use root to run cron job:
# find /var/adm/sa/* ! -name *gz -a -name ex* -exec /usr/contrib/bin/gzip {} \;

Sometimes, it performed successfully; sometimes, it returned:
find: missing conjunction

Is it related to system loading or any problem? Thanks

4 REPLIES 4
Sridhar Bhaskarla
Honored Contributor

Re: find: missing conjunction

Hi,

Put the strings specified with -name option in quotes so that shell will not try to expand them before find executes.

#find /var/adm/sa* ! -name '*.gz' -a -name 'ex*' ......

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Sridhar Bhaskarla
Honored Contributor

Re: find: missing conjunction

Hi,

Put the strings specified with -name option in quotes so that shell will not try to expand them before find executes.

#find /var/adm/sa* ! -name '*.gz' -a -name 'ex*' |xargs /usr/contrib/bin/gzip

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
ikbea
Frequent Advisor

Re: find: missing conjunction

Thanks. It works without error again after quoted with ' or " in shell prompt.
I will try to run in cron job later to test.

Also related link
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x958f8cc5e03fd6118fff0090279cd0f9,00.html
Muthukumar_5
Honored Contributor

Re: find: missing conjunction

When ever you try commands with * ( wild card character's ) on shell try to delimit it with \ character there.

So use as,

find /var/adm/sa/ ! -name \*gz -a -name ex* -exec /usr/contrib/bin/gzip {} \;

Where -->
/var/adm/sa/* is same as /var/adm/sa/ or /var/adm/sa directories there.

Or you can delimit the character's with quotes there as,

find /var/adm/sa/ ! -name "*gz" -a -name "ex*" -exec /usr/contrib/bin/gzip {} \;

-Muthu
Easy to suggest when don't know about the problem!