- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- find: missing conjunction
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2002 02:27 PM
03-26-2002 02:27 PM
I have a couple of systems that give me an error when using the find command.
# find . -name whatever*
sh: find: missing conjunction
What variable do I set to allow the system to use wildcards with the find command?
Note: find is the only command I noticed with this error all other commands seem to have no problems with *.
I leave it to those wiser and smarter than myself.
Thanks,
Kel
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2002 02:33 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2002 02:34 PM
03-26-2002 02:34 PM
Re: find: missing conjunction
The problem is not find but rather that the shell is expanding whatever* into multiple filenames when -name expects 1 argument. The fix is simply to enclose 'whatever*' in single-quotes so that the shell doesn't expand the filenames.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2002 02:34 PM
03-26-2002 02:34 PM
Re: find: missing conjunction
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x0026cbaac6dcd5118ff40090279cd0f9,00.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2002 02:39 PM
03-26-2002 02:39 PM
Re: find: missing conjunction
It is with the shell how it is expaning the wildcards. To get more idea about how it is doing, run a set -x before you execute the find command.
$set -x
$find . whatever*
Look at the command that got executed after the expansion. It will explain your "why".
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2002 02:50 PM
03-26-2002 02:50 PM
Re: find: missing conjunction
Since I only have this on some systems, then I presume some shells are set to allow this and some have problems based on (possibly) initial setup. Is it possible to set up a "permanent variable" to allow this during system boot so the command will work without using quotes? Or is this a one time build compiled into the shell with no way to modify.
Thanks for the help.
As always, points to follow.
Kel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2002 03:02 PM
03-26-2002 03:02 PM
Re: find: missing conjunction
myfile1
myfile2
myfile3
yourfile
myfile* expands to myfile1, myfile2, and myfile3 but yourfile* simply expands to yourfile.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2002 03:28 PM
03-26-2002 03:28 PM
Re: find: missing conjunction
I'm not sure but I think I wasn't clear.
In the find statement I am using, I want it to expand the wildcard and list all files appropriately.
I can go to two different systems, type the exact same command and get two different outputs.
System1:
find / -name *.log
/etc/rc.log
/var/adm/log/syslog.log
(and so on)
System2:
find / -name *.log
sh: find: missing conjunction
I would presume (although this may be too much to ask) if one system can do it. Then the second system can be set/made/prodded/begged/threatened/etc. to do it on a permanent basis. (Unless it is built into the shell itself)
I do not mind modifying my command to force it to work, but I am admittedly curious as to whether or not there is a fix so to speak for this little anomally.
Either that or I think I'm understanding everyone's comments and am not. Heck, I'm open to that too. ;)
Thanks,
Kel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2002 03:45 PM
03-26-2002 03:45 PM
Re: find: missing conjunction
cd /tmp
mkdir tmp1
cd tmp1
cp /dev/null myfile1
cp /dev/null myfile2
cp /dev/null myfile3
cp /dev/null yourfile
ls (you should see all four files listed)
Now let's play with find to list the myfiles:
find . -name 'myfile*'
myfile1
myfile2
myfile3
find . -name 'yourfile*'
yourfile
find itself expands the wildcard pattern matching; we don't want the shell to do it. Maybe this will show you what's wrong:
find . -name myfile* actually appears to the find command as
"find . -name myfile1 myfile2 myfile3" but in order for that syntax to work it would really need to be this:
"find . \(-name myfile1 -o -name myfile2 -o -name myfile3 \)" - the -o means OR
The shell is simply doing what you tell it to do and that is why we want single quotes - no shell expansion.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2002 04:38 PM
03-26-2002 04:38 PM
Re: find: missing conjunction
I believe I understand now.
In other words; (Reader's Digest abridged)
not single quoting the argument causes a conflict (for lack of a better term) between the -name option (wanting to expand the *) and the shell (also wanting to expand the *) using the single quotes tells the shell not to do anything and the -name option is now allowed to do it's work without conflict.
Just curious again.
On my "working" system (The system w/o the missing conjunction statement)something is, I will assume already telling the shell not to expand the *, thus allowing the -name option to be the one to expand it. Do you know what that something is?
Hopefully, I'm not being too annoying. Curiousity is my curse. I can't help myself. For a small consollation I will reward points generously, as much for the good information as for the hard work of pounding it into my thick noggin. :)
Thanks,
Kel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2002 07:53 PM
03-26-2002 07:53 PM
Re: find: missing conjunction
On your "working" system, how many files are listed when you do "ls *.log"? None I'd guess (assuming your current directory is the same one as when you enter the find command).
How many are listed when you do the same ls command on the system where you get the missing conjunction error? More than 1, right? Again, I'm assuming your current directory is the same as when you enter the find command.
Your issue happens because the shell expands *.log into the list of files in your current directory ending with .log. If you cd into a directory that has no .log files and run your find command (without quoting *.log), it will work. If you have 1 file ending in .log in your current directory, the shell will expand *.log to just that one file name and find will search for files with that name. If you have more than 1 file ending in .log you will get the missing conjunction error.
There is nothing telling the shell to not expand the *. Expansion (perhaps interpretation is a better term) is going to be done by the shell unless you quote what you specify as the argument for -name.
Always quote the arg for -name when it contains a shell metacharacter (wildcard).
Clear as muddy water?
Darrell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2002 08:20 PM
03-26-2002 08:20 PM
Re: find: missing conjunction
Do a "set -f" before running your find command.
"set -f" will turn off filename expansion, and your find command will work as you want.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2002 08:26 PM
03-26-2002 08:26 PM
Re: find: missing conjunction
This probably answers your question as well:
<< can go to two different systems, type the exact same command and get two different outputs.
System1:
find / -name *.log
/etc/rc.log
/var/adm/log/syslog.log
(and so on)
System2:
find / -name *.log
sh: find: missing conjunct
>>
Methinks, on System1, your .profile/.login has a "set -f" whereas System2 does not.
Hope this exorcises the ghost in the machine.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2002 06:54 AM
03-27-2002 06:54 AM
Re: find: missing conjunction
Obviously I was wrong that nothing turned off file name expansion in a shell. I didn't know about "set -f". Nice one Deepak!
My answer still holds unless set -f is used in a bourne shell or one of it's derivatives.
Darrell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2002 01:26 AM
03-28-2002 01:26 AM
Re: find: missing conjunction
I learned that "trick" from this forum itself. Thanks to Robin.
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xb8c89200caded5118ff40090279cd0f9,00.html
This is why I love this forum!
While on the topic, I must mention that another effect of running a "set -f" is that it turns off filename autocompletion (the esc-esc thingy). If you're as addicted to that escape key as I am, you may want to do a "set +f" to undo the evil effects of the "set -f".
