From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "E. Richard Glazier" Newsgroups: gmane.os.tru64.managers Subject: SUMMARY: KSH behavior (* -vs- no *) Date: Tue, 19 Nov 2002 17:45:15 +0000 Sender: tru64-unix-managers-owner@ornl.gov Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-Trace: main.gmane.org 1037727826 3767 80.91.224.249 (19 Nov 2002 17:43:46 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 19 Nov 2002 17:43:46 +0000 (UTC) Return-path: Original-Received: from sws1.ctd.ornl.gov ([160.91.20.101]) by main.gmane.org with smtp (Exim 3.35 #1 (Debian)) id 18ECPV-0000y6-00 for ; Tue, 19 Nov 2002 18:43:41 +0100 Original-Received: (qmail 12856 invoked by uid 5); 19 Nov 2002 17:45:23 -0000 Original-Followup-To: poster Precedence: bulk Original-Received: (qmail 12847 invoked by uid 49493); 19 Nov 2002 17:45:23 -0000 Original-Received: from erglazier@hotmail.com by sws1 by uid 49491 with qmail-scanner-1.14 (clamscan: 0.51. spamassassin: 2.50-cvs. Clear:SA:0(-0.9/5.0):. Processed in 0.440653 secs); 19 Nov 2002 17:45:23 -0000 Original-Received: from unknown (HELO emroute1.cind.ornl.gov) (160.91.4.119) by 0 with SMTP; 19 Nov 2002 17:45:22 -0000 Original-Received: from emroute1.cind.ornl.gov (localhost [127.0.0.1]) by emroute1.cind.ornl.gov (PMDF V6.1-1 #39060) with ESMTP id <0H5U007SU3ZIPS@emroute1.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Tue, 19 Nov 2002 12:45:22 -0500 (EST) Original-Received: from hotmail.com (f126.law3.hotmail.com [209.185.241.126]) by emroute1.cind.ornl.gov (PMDF V6.1-1 #39060) with ESMTP id <0H5U00GBX3ZGI3@emroute1.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Tue, 19 Nov 2002 12:45:17 -0500 (EST) Original-Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Tue, 19 Nov 2002 09:45:16 -0800 Original-Received: from 63.93.126.51 by lw3fd.law3.hotmail.msn.com with HTTP; Tue, 19 Nov 2002 17:45:15 +0000 (GMT) X-Originating-IP: [63.93.126.51] Original-To: tru64-unix-managers@ornl.gov X-OriginalArrivalTime: 19 Nov 2002 17:45:16.0344 (UTC) FILETIME=[6B841B80:01C28FF3] Xref: main.gmane.org gmane.os.tru64.managers:2497 X-Report-Spam: http://spam.gmane.org/gmane.os.tru64.managers:2497 Thanks to everyone who responded, which was about 25 people! They all said essentially the same thing. In summarary, the '*' is being interpreted by the shell before it is passed to grep. The difference in my two machines was where I was sitting in the directory structure. 'ps -ef | grep ora*' returned results when I was sitting at / because of all the files and directories that start 'ora' under /. Some suggested doing an echo ora and an echo ora* from my directory location as a means of seeing how the ora* would be interpreted. I did a quick test on my own machine. From /etc I did an 'echo rc*'. It returned rc.config and rc.config.common. I then did a 'set +x' and then 'grep rc*'. My statement was interpreted as 'grep rc.config rc.config.common', and two lines were returned containing 'rc.config'. I lastly did 'grep rc.config rc.config.common' and got the same output. I selected one response that summarizes this, and represents most responses I got. On Mon, Nov 18, 2002 at 06:14:34PM +0000, E. Richard Glazier wrote: >This is only just to satisfy my curiosity. > > I have 2 GS80s running 5.1 PK5. They are exactly the same. When logged >in as root on each machine (ksh is root's shell on each), I get different >output from 'ps -ef | grep ora*' One machine returns about 30 processes >that start 'ora' and the other machine returns nothing. It seems one >machine returns anything that starts 'ora', and the other is looking >specifically for a process 'ora*'. Using 'ps -ef | grep ora' will work on >both machines. What's causing the difference in the metacharacter >interpretation? the ora* is interpreted by the shell, not grep, so the command that gets run depends on what's in your current directory. For example, if you have a file called oral_hygiene in the current directory, then running: ps -ef | grep ora* will actually run ps -ef | grep oral_hygiene which will of course return nothing (unless you do happen to have a program running called oral_hygiene - stranger things have been known!) It emphatically *won't* find your oracle processes. The * is completely unnecessary for what you're trying to do; just leave it out. It also looks like you're expecting the * to work as it does for ls and so on. Grep can accept wildcards, but: (a) You need to put them in quotes to stop the shell globbing expanding them (b) They use regular expression rules, not file globbing rules. So, as an example, suppose you wanted to look for processes like orafoodb and orabard you would do something like this: ps -ef | grep 'ora[a-z]*db' Tim -- Dr Tim Cutts _________________________________________________________________ The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail