Xref: utzoo comp.unix.questions:28472 comp.unix.programmer:998 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!davis From: davis@pacific.mps.ohio-state.edu ("John E. Davis") Newsgroups: comp.unix.questions,comp.unix.programmer Subject: fork question Message-ID: Date: 6 Feb 91 19:24:53 GMT Sender: news@pacific.mps.ohio-state.edu Reply-To: davis@pacific.mps.ohio-state.edu (John E. Davis) Followup-To: comp.unix.questions Distribution: comp Organization: "Dept. of Physics, The Ohio State University" Lines: 58 Hi, I have a program, called `sline' with the front end: main() { char *position,*init_status,*exit_status,*terminal; int matched; int child_pid, parent_pid, parent; FILE *fpstatus; parent_pid = getppid(); /* we create an identical process to do the work and exit the parent */ /* now fork off a child to do all of the work */ switch (child_pid = fork()) { case 0: /* this is the child; let it go on */ break; case -1: /* oops... something wrong! */ perror("sline"); exit(1); break; default: /* the parent... may exit after sending the pid of the child */ printf("%d\n",child_pid); exit(0); } [....] As you can see, the program forks with the parent exiting returning the pid of the child process. This is precisely what happens when I run it at the unix command line. Now in my .login I have the line: . . set slinepid = `sline` . . which sets the variable `slinepid' to the pid of the child. This variable gets set but my .login gets hung up here-- ie. it does not continue beyond this point; I have to ^C to kill it. What fundamental point am I missing here? It seems to me that the .login is waiting for the child to exit as well. Thanks, -- John bitnet: davis@ohstpy internet: davis@pacific.mps.ohio-state.edu