home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.programmer
- Path: sparky!uunet!ferkel.ucsb.edu!taco!rock!stanford.edu!ames!sun-barr!cs.utexas.edu!wupost!gumby!destroyer!ubc-cs!uw-beaver!uw-coco!nwnexus!jhgrud!polari!errant@polari.online.com
- From: errant@polari.online.com
- Subject: Need help with System()
- Message-ID: <1992Aug28.140705.501@polari>
- Summary: System() wont work correctly
- Keywords: Need help with System()
- Organization: Seattle Online Public Access Unix. (206) 328-4944 (all lines telebit-equipped)
- Date: Fri, 28 Aug 1992 14:07:05 GMT
- Lines: 20
-
- Am unit testing a much larger program, and have run into a glitch
- with the below code:
- main()
- {
- if (system ("/bin/ps -el | /usr/bin/fgrep -c cron") == 1)
- printf ("good\n");
- else
- printf ("bad\n");
- }
-
- When program is run the following results:
- #a.out
- 1
- bad
- #
-
- As can be seen, it shows that 1 is how many times cron is
- detected, but then it drops through and prints bad. What gives??
- Is there something I could add to the code that would show me??
- I'm stumped!
-