Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > perl system calls

perl system calls
Thread Tools
Jaey
Mac Elite
Join Date: Dec 2003
Status: Offline
Reply With Quote
Aug 12, 2004, 01:08 AM
 
Why can I not do
Code:
system("cd /anywhere");
I always get the "No such file or directory" error.
     
Brass
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status: Offline
Reply With Quote
Aug 12, 2004, 01:20 AM
 
Don't know why. But in any case, is there any reason you're not using:

chdir "/anywhere"

?

system should only really be used for things that Perl doesn't provide itself.
     
Jaey  (op)
Mac Elite
Join Date: Dec 2003
Status: Offline
Reply With Quote
Aug 12, 2004, 01:38 AM
 
Eh, I didn't know about chdir. Thanks
     
qyn
Dedicated MacNNer
Join Date: Dec 2000
Location: sj ca
Status: Offline
Reply With Quote
Aug 12, 2004, 06:28 PM
 
system() spawns a shell (in a separate process). So your sub-process cd's to the directory just fine, but YOUR process stays put. Unless you use chdir().
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 10:40 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,