- 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
Discussions
Discussions
Forums
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
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