Assign temp file from cgi and read it in .sh

时间:2019-05-31 20:44:18

标签: perl variables csh cgi

I have .cgi file and .sh file. The cgi is calling the script which is the .sh file.
How will assign the tempfile created from .cgi and pass it to the .sh file?

Example below:

(on my CGI, $tmpfile is created)

#! /usr/local/bin/perl

use CGI qw/:standard :html3/;      
use CGI::Carp qw(fatalsToBrowser); 

my $tmpfile = "$dir/output.$$";

(on my .sh file, i want to use the $tmpfile from cgi)

#! /bin/csh -fb
umask 0

set tmpfile2 = $tmpfile  #not working

1 个答案:

答案 0 :(得分:0)

就像@muru所说的那样,将其放入环境中:

$ENV{tmpfile}= $tmpfile;

或将其作为参数传递给脚本。这比乱扔环境要干净得多。