PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
MathewByrne
Forum Commoner
Posts: 38 Joined: Sat Mar 27, 2004 9:49 pm
Location: Australia
Post
by MathewByrne » Mon Mar 06, 2006 7:09 am
I'm trying to implement a quick php shell script which will take me to a specified directory. This doesn't work however:
In fact nothing happens inside bash. Is this a limitation of scripting in PHP?
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098 Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia
Post
by Chris Corbyn » Mon Mar 06, 2006 7:17 am
MathewByrne wrote: I'm trying to implement a quick php shell script which will take me to a specified directory. This doesn't work however:
In fact nothing happens inside bash. Is this a limitation of scripting in PHP?
Nope. PHP does change it's working directory.... but that's only local to the script... it won't effect your bash environment.
You could possibly try this but it'll no doubt have the same result:
MathewByrne
Forum Commoner
Posts: 38 Joined: Sat Mar 27, 2004 9:49 pm
Location: Australia
Post
by MathewByrne » Mon Mar 06, 2006 7:26 am
Yeah I noticed calling getcwd(); had changed. Hmm... might have to actually write a shell script for once... Anyone have a better solution?
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098 Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia
Post
by Chris Corbyn » Mon Mar 06, 2006 7:40 am
MathewByrne wrote: Yeah I noticed calling getcwd(); had changed. Hmm... might have to actually write a shell script for once... Anyone have a better solution?
Even BASH scipts do the same thing. I'm not sure what the solution is but it must be very simple... I've tried and failed in the past too.
MathewByrne
Forum Commoner
Posts: 38 Joined: Sat Mar 27, 2004 9:49 pm
Location: Australia
Post
by MathewByrne » Mon Mar 06, 2006 8:14 am
Ah well, I'll make do with a buch of alias ___='cd ...___' for now
dubbelpunt
Forum Newbie
Posts: 3 Joined: Thu Mar 09, 2006 8:01 am
Post
by dubbelpunt » Thu Mar 09, 2006 8:23 am
if you need to change your directory, you can use the function chdir().