To myself I'll offer a resounding "Duh!" Sometimes the simplest things are the hardest to see. Thanks very much!
-----Original Message----- From: Bob Showalter [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 18, 2004 7:02 AM To: 'Peterson, Darren - Contractor.Westar'; '[EMAIL PROTECTED]' Subject: RE: working directory with exec command Peterson, Darren - Contractor.Westar wrote: > I'm trying to use fork and exec to kick-start other processes on a > Linux box. As with Win32::Process::Create, I'd like to somehow > specify or point towards a working directory for the new process > since some data files are expected via relative path. I actually > tried passing a compound command such as "cd > /home/otbsaf/OTBSAF/src/OTBSAF;./otbsaf" to exec to hope a directory > switch would happen as I intended. The new process displays its > current directory and the directory shown was that from which the > perl script was running, not the hoped for otbsaf. Just use Perl's chdir() after you fork: defined(my $pid = fork) or die $!; unless ($pid) { chdir('/home/otbsaf/OTBSAF/src/OTBSAF') or die $!; exec './otbsaf' or die $!; } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>