The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Calling a perl script from a perl script new2ss Shell Programming and Scripting 3 02-06-2007 08:17 PM
to kill a process in perl gurukottur Shell Programming and Scripting 2 11-20-2006 01:01 AM
My "Bread and Butter" Process Keep Alive Perl Script.... Neo Tips and Tutorials 0 01-08-2005 02:17 AM
PERL: wait for process to complete dangral Shell Programming and Scripting 2 04-21-2004 12:37 PM
Killing a process from perl script. sharuvman Shell Programming and Scripting 3 04-01-2004 09:10 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #8  
Old 12-08-2005
Moderator
 

Join Date: Sep 2002
Location: Hong Kong, China
Posts: 1,477
You would like the Perl script chdir() to affect the parent shell process? That is impossible in this case as exec() won't return, so when the Perl script ends, the original shell process also ends.

I'm sorry that I have probably misunderstood your question. I would say the method is only for the original process image (shell script in your case) affecting the later, replaced process image (the Perl script in your case), and doesn't work if you expect the parent environment to be influenced after exec(), as it won't return at all.
Reply With Quote
Forum Sponsor
  #9  
Old 12-08-2005
vino's Avatar
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,699
So, as I understand, whatever the perl script does will not affect the parent shell.

Say, in this case, after I change to the new directory, I cant remain in that new directory even after the perl script exits. Right ?
Reply With Quote
  #10  
Old 12-09-2005
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,298
Absolutely correct. What you are asking: 'Can I source a file from inside perl?'
No. Because you have to call exec. This is exactly the same problem you have with shell scripts doing a cd and then exiting.
Reply With Quote
  #11  
Old 12-09-2005
vino's Avatar
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,699
Thanks Jim.

Vino
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
linux

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 11:58 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0