home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / question / 10579 < prev    next >
Encoding:
Text File  |  1992-08-31  |  1.3 KB  |  52 lines

  1. Xref: sparky comp.unix.questions:10579 comp.lang.c:13031
  2. Newsgroups: comp.unix.questions,comp.lang.c
  3. Path: sparky!uunet!infonode!henders
  4. From: henders@infonode.ingr.com (Greg Henderson)
  5. Subject: 'system' call uses 'sh'... Can I change this??
  6. Message-ID: <1992Aug31.203936.20409@infonode.ingr.com>
  7. Summary: Want to change system call from using sh to something else.
  8. Keywords: system sh
  9. Organization: Intergraph Corporation, Huntsville, AL.
  10. Distribution: comp
  11. Date: Mon, 31 Aug 1992 20:39:36 GMT
  12. Lines: 38
  13.  
  14.  
  15. Hopefully someone has run across a way to work around this...  
  16.  
  17. Take this simple program -->
  18.  
  19. main(int argc, char *argv[])
  20. {
  21.     char str[100];
  22.     printf ("enter shell command:");
  23.     gets (str);
  24.     system (str);
  25. }
  26.  
  27. and I call it g.c and do this ->
  28.  
  29. $ make g
  30.         acc  -O  g.c -o g
  31. $ g
  32. enter shell command:sleep 100
  33.  
  34.  
  35. and on another window I check my process listing -->
  36.  
  37.     greg 26973 26970  0 08:06:57 ttyp0    0:03 -ksh
  38.     greg 27786 26973  0 15:27:26 ttyp0    0:00 g
  39.     greg 27787 27786  0 15:27:31 ttyp0    0:00 sh -c sleep 100
  40.     greg 27788 27787  0 15:27:31 ttyp0    0:00 sleep 100
  41.  
  42.  
  43. Does anyone know a way to get the system call to use  a different shell
  44. than 'sh'?  like maybe 'ksh'...
  45.  
  46.  
  47. -- 
  48.  
  49. Greg Henderson   henders@infonode.ingr.com   ...uunet!ingr!infonode!henders
  50.  
  51.  
  52.