Source.cshrc file inside Perl


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Source.cshrc file inside Perl
# 1  
Old 10-30-2014
Wrench Source.cshrc file inside Perl

I have a file which is basically .cshrc
It contains lines such as:

Code:
setenv <variable> <value>...
                                      set path=(<dir> <dir>)
                                      source <another_file>

I can run this file using source from the shell.
But I cannot do it from perl.. except from creating another file which is perl-executable using do, or parsing the file and using ENV{}, which I don't want to do.

I just simple want to source this .cshrc in my Perl script
I tried so many methods ... Nothing is working

Thanks
Kshitij
# 2  
Old 10-30-2014
I'm afraid you need to call your Perl script from a shell script which sources your environmental changes or else mangle the %ENV hash.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Programming

Create a C source and compile inside Python 1.4.0 to 3.7.0 in Python for ALL? platforms...

Hi all... As you know I like making code backwards compatible for as many platforms as possible. This Python script was in fact dedicated for the AMIGA A1200 using Pythons 1.4.0, 1.5.2, 1.6.0, 2.0.1, and 2.4.6 as that is all we have for varying levels of upgrades from a HDD and 4MB FastRam... (1 Reply)
Discussion started by: wisecracker
1 Replies

2. Shell Programming and Scripting

Search inside a file, PERL

HEllo!! I need a script in perl that see inside a file(file.txt) that has only one row. The row contains only this text: logs_yearly = 20120628113345 I want that the script does this: "Search in the file, if the date 20120628 is actual date" Thank you!! ---------- Post... (4 Replies)
Discussion started by: super_sun
4 Replies

3. Shell Programming and Scripting

Opening File names with spaces inside it !- PERL

I developed a perl code..And the excerpt from it is given below... open(HANDLE,$cmp_path) ; #reading the xml file from the file path while($file_path = <HANDLE>) I have list of XML files to read from a folder. It has some spaces inside the name of the file...I used "\"... (2 Replies)
Discussion started by: gameboy87
2 Replies

4. UNIX for Dummies Questions & Answers

After modifying .cshrc file, ls: Command not found

I am using Redhat 4.1.2, tcsh shell To add a program to my path, I added the following line to my .cshrc file: set path = (/home/R/R-2.11.0/bin/ /home/R/R-2.11.0/library) It worked, I am able to run the program I wanted. But the pathway above overwrote all other existing paths - so I can no... (1 Reply)
Discussion started by: Euphoria
1 Replies

5. Shell Programming and Scripting

alias defining problem in .cshrc file

Hi folks, I'm trying to define the following command as alias in .cshrc file: ls -ltr | grep ^d | awk '{print $9}' | xargs du -hs I defined it as the following: alias nirdirs '`ls -ltr | grep "^d" | awk "{print \\$9}" | xargs du -hs`' I've got the following error when I've run the alias:... (7 Replies)
Discussion started by: nir_s
7 Replies

6. Virtualization and Cloud Computing

.cshrc file

Hi All, I was hoping someone could help me with the following query I have please in relation to NX Nomachine. Is there a way to get my .cshrc file in say my “US” home dir” to run when I login to another server e.g say a UK server? Any advise would be much appreciated, thanks (3 Replies)
Discussion started by: zainster
3 Replies

7. Shell Programming and Scripting

doing grep inside perl file

Hi have one Perl file inside that i am defining at an array file. @temp_vmdk_files = `grep vmdk '$guest_vmx'` where my $guest_vmx=/vmfs/volumes/47e40fec-9c8bb7f7-d076-001422159f8a/BES Exchange/BES-Exchange.vmx and i am just want to do grep of "vmdk" files from the above path but when... (5 Replies)
Discussion started by: bp_vardhaman
5 Replies

8. UNIX for Dummies Questions & Answers

flags inside .cshrc

Hi, I use a specific utility in my .cshrc for setting up the right fonts and I believe it's sufficient to run it once for a whole session. Since I have sourced it in my .cshrc, it runs every time I do a source of .cshrc or invoke every new terminal. To resolve this issue, I thought of... (1 Reply)
Discussion started by: oldtrash
1 Replies

9. UNIX for Dummies Questions & Answers

How to set the CVSROOT in the .cshrc file?

I am learning the CVS in Unix now, but in the book it said I need to add the CVSROOT to the end of the .cshrc file. I had use emacs to edit it and add CVSROOT=/CVS, but when I run script .cshrc then it said CVSROOT=/CVS: Command not found. I had already think that for a hour, so could any person... (1 Reply)
Discussion started by: a8111978
1 Replies
Login or Register to Ask a Question