Perl Csh - setenv ENV change environment variable


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Perl Csh - setenv ENV change environment variable
# 1  
Old 11-21-2011
Perl Csh - setenv ENV change environment variable

I have 3 programs, 1 in perl, 2 in csh: call them perl1, csh1 and run.ol

I need perl1 to set csh1 variable NOLOG_qsub = ""

I need perl1 to run, run.ol

run.ol takes the executable and input and outputs to output

run.ol
Code:
#!/bin/csh -f
# run.ol executable input output

perl1 should set NOLOG_qsub = "" and
run - run.ol <executable> <input> <output>

NOTE: perl1 needs to provide the exe, input, and output for run.ol

perl1
Code:
#!/usr/local/bin/perl -w
 
use Env;
 
$ENV{NOLOG_qsub} "";
 
run.ol executable input output;

csh.1
Code:
if ( $?NOLOG_qsub ) then
    set syncy = ''
    unsetenv NOLOG_qsub

Thanks!

Austin
# 2  
Old 11-22-2011
I assume there is much more to your perl script than the few lines you provided, but going with what you have:
Code:
#!/usr/local/bin/perl -w
 
use Env;
 
$ENV{NOLOG_qsub} = "";
system("run.ol $executable $input $output");

Hope this helps.
This User Gave Thanks to m.d.ludwig For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to use env command to change GREP_OPTIONS variable?

How could I use the env command to change the enviroment variable GREP_OPTIONS so that grep is not case sensitive by setting it to "-i'? So that the command: grep a <<< A Will produce the same output as grep -i a <<< A (8 Replies)
Discussion started by: steezuschrist96
8 Replies

2. Shell Programming and Scripting

How to change Linux Terminal environment variable in a perl or bash script?

Hi, I meet an problem that it cannot change Terminal environment variable in a perl or bash script. This change can only exist and become effective in script lifetime. But I want to make this change take effect in current opened Terminal. In our view, the thought seems to be impossible, As... (9 Replies)
Discussion started by: weichanghe2000
9 Replies

3. Shell Programming and Scripting

Perl error with $ENV variable

Hello my friends i have created a perl cgi script to see browser support for text and graphics but $ENV variable is not working , Code is: #!/usr/bin/perl #Author Ravinder kumar # START use warnings; $nongraphic = 'lynx|CERN-Linemode|elinks'; $client = $ENV{'HTTP_USER_AGENT'}; $text... (9 Replies)
Discussion started by: rink
9 Replies

4. Web Development

Deny from env=env-variable Does not work

(Above from Apache docs). On my system, using: SetEnvIf User-Agent Mozilla IsBad=1 Order allow,deny Allow from all Deny from env=IsBad ...I see that environment variable is set (using phpinfo()) but the page is still served. No errors in the Apache logs. (1 Reply)
Discussion started by: gnurob
1 Replies

5. Shell Programming and Scripting

how can i change value of incorrect env variable?

Hi, I have ORACLE_HOME= This is wrong, and I want to find this in the file, and replace it with ORACLE_HOME=/home/oracle/product/10.2 can anyone please assist? thanks (2 Replies)
Discussion started by: JamesByars
2 Replies

6. Shell Programming and Scripting

Not able to change the environment variable in k shell

Hi All, I am trying the following to set the environment variable in my scirpt.But it is not setting with the correct value. Can you guys please help me out to get the correct value. 1. I have environment variable NLS_LANG=American_America.UTF8 2. In my script (ksh) i am trying the following... (1 Reply)
Discussion started by: girish.raos
1 Replies

7. Shell Programming and Scripting

how to reuse a shell script to change env from perl

Hi: I am trying to reuse an existing shell script foo1.csh to set environment variables inside a perl script and its childern processes. Is it possible at all to make those environment variables persistent in the main perl process and its children processes? Do I have to create a new... (4 Replies)
Discussion started by: phil518
4 Replies

8. Shell Programming and Scripting

How to do a formatted substittion in perl with a csh variable?

Hmm quite difficult for me to express my problem in one sentence.Introduction {i am a newbee to csh perl, awk and stuff, and by surfing these forums i managed to build quite a big code using all three of them in a script. Have to admitt, it was not a good idea, and its the perfect example of how... (3 Replies)
Discussion started by: Radamez
3 Replies

9. UNIX for Dummies Questions & Answers

Why does set also change setenv variables?

I thought that set and setenv was easy enough to understand until I started experimenting. I noticed the same problem in a previous thread, so I will use it as an example. set command gave the following output: argv () cwd /homes/e/ee325328/assignment.2 home /homes/e/ee325328 path ( a... (2 Replies)
Discussion started by: benwj
2 Replies

10. Shell Programming and Scripting

Pass csh variable to Perl

Hi All, I am trying to put the csh variable into a perl. In the below case, i am trying to put the csh variable "var" into my perl code. I tried to use '"$var"' but i don;t think it works. Can anybody help me pls? #!/bin/csh set var = `echo "xxx"` perl myperlcode.pl file ... (9 Replies)
Discussion started by: Raynon
9 Replies
Login or Register to Ask a Question