Problems with sourcing a file 
Author Message
 Problems with sourcing a file

Keywords:

Hi Readers,

  I am posting this for a friend of mine(and I am myself curious).

  The SOURCE command doesn't seem to work in Perl i.e
  --------------------------
  #!/usr/bin/perl
  system("source .cshrc")
  --------------------------

  doesn't source the .cshrc file(just an example).
  Even the following doesn't work

  ---------------------------
  #!/usr/bin/perl
  system("sh source .cshrc")

  ---------------------------
  NOTR: The above scripts are supposedly executables.
  Does anyone know what could be wrong or what the correct way is?.
  Thanks in advance.

Regards,
Raghu.



Sat, 13 Sep 1997 03:00:00 GMT  
 Problems with sourcing a file
: Keywords:

: Hi Readers,

:   I am posting this for a friend of mine(and I am myself curious).

:   The SOURCE command doesn't seem to work in Perl i.e
:   --------------------------
:   #!/usr/bin/perl
:   system("source .cshrc")
:   --------------------------

"source" is a csh keyword. I imagine that system invokes /bin/sh which does not
support "source". I suppect you will need to do something like this piece of
untested, off-the-top-of-my-head code

system("/bin/csh")
which should then automatically source the ~/.cshrc.
Note, that since system invokes a child shell, which in turn invokes csh, it is the
csh shell that gets the new environment settings. These environment variables will
not be inherited back to the invocation program (ie. perl).

Andrew



Fri, 26 Sep 1997 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Problems with sourcing a file in perl.

2. V4 vs V5 sourcing problem

3. sourcing (bash) config files within perl

4. workaround for sourcing file from perlscript

5. Sourcing Unix environment file?

6. sourcing a file in Perl

7. sourcing (bash) config files within perl

8. Sourcing files from my perl script

9. Not sourcing .cshrc

10. Sourcing from within perl ?

11. Sourcing in shell scripts into perl

12. Sourcing with a twist of Parsing ?

 

 
Powered by phpBB® Forum Software