On 06/13/2007 12:26 AM, [EMAIL PROTECTED] wrote:
Hi All,

I'm pretty new to Perl. I was trying to write up a perl script that
can help set up my working env, for example, once log into Linux
server, run the perl script, it'll move to another folder and
configure some env variables.

I tried using
`cd dest_folder`                       or
system "cd dest_folder"           or
exec "cd dest_folder"

but after running script, the current folder doesn't change at all.
Anyone please shed some lights on this.



You can't. To change environment variables and the current directory for the current shell, you have to use a script for that shell (e.g. a bash script for a bash shell), and you have to invoke it a certain way.

For example, if your script is called myscript.sh, you'd do this:

. myscript.sh

Notice the period at the beginning of the line.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to