Perl: export variable to shell


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Perl: export variable to shell
# 1  
Old 09-11-2003
Perl: export variable to shell

Hi,
I am running a series of scripts and I need to transport a particular variable across many scripts. I thougt of defining an environmental variable which I could access through. But I found that the variable dies as soon as the script ends..

Currently I write this variable to a temporary file and access from the other scripts.

Is there any other easier solution?

Thanks
# 2  
Old 09-11-2003
I assume one script calls the other ones and needs to pass the variable on? See this link:

https://www.unix.com/unix-for-dummies-questions-and-answers/1565-passing-parameters-script.html?s=

What shell are you using?
# 3  
Old 09-11-2003
They are different processes..
It may or may not call the other and there is no order..

I am running Perl5 under cshell.

Thanks
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Usage of shell variable in perl command

Hi, I have a shell script, In which i have variable "var1" and some perl command inside shell script. export var1='coep -n rst-a2p-hinje.vci.all.com -c' perl -pi -e 's/^/coep -n rst-a2p-hinje.vci.all.com -c /' command.txt currently I am adding value of var1 in command.txt file by... (2 Replies)
Discussion started by: rakeshtomar82
2 Replies

2. Shell Programming and Scripting

Use shell variable in perl command line

Hi, I would like to use a shell variable $amp in my perl command line. for fa in $WORKSPACE/*.fa; do amp=`grep ">.*" $fa | sed -e's#>\(.*\)#\1#g'` ampsam="$WORKSPACE/$base/$base.$amp.sam" sqheader=`grep "^@SQ.*SN:$amp.*" $sam` printf "$sqheader\n" >> $ampsam ... (3 Replies)
Discussion started by: jdilts
3 Replies

3. Shell Programming and Scripting

Using variable from shell script in perl file

Hey, So I have a shell script that outputs some variables, call them $a and $b. I know in shell scripting if I wanted to use the variables in another shell script I'd do sh code.sh "$a" "$b" How can I do something similar with perl? (2 Replies)
Discussion started by: viored
2 Replies

4. Shell Programming and Scripting

How to export a variable from a subshell to the parent shell?

A not-too-ugly solution to this classic problem... #!/bin/bash mknod fifo p ( echo 'value' > fifo & ) VARIABLE=`cat fifo` rm fifo Whatdcha think? Good? No good? (9 Replies)
Discussion started by: vomv1988
9 Replies

5. Shell Programming and Scripting

Passing perl variable to shell command

Can we pass perl variable to shell commands. If yes, please give some example. (2 Replies)
Discussion started by: Anjan1
2 Replies

6. Shell Programming and Scripting

Assign perl output to ksh shell variable

Hello, I am writing a ksh script on an AIX system. I need to get the date and time from a file into a variable. I found the following perl script from another post on this site and modified it slightly to output the format I need: perl -e '@d=localtime ((stat(shift)));... (4 Replies)
Discussion started by: swimp
4 Replies

7. Shell Programming and Scripting

Set/Export Env Vars from with Shell Script With Input Variable

I have a shell script I want to run that will set environment variables based on the value of an input variable submitted when the shell script is called. For example: $ mgenv.sh prod This would set environment variables for prod $ mgenv.sh test This would set environment variables... (1 Reply)
Discussion started by: brtaylor73
1 Replies

8. Shell Programming and Scripting

Perl script variable to read shell command

Solaris 10 Korn shell ksh, Hi there, I have figured out to get yesterday's date which is using the below command: TZ=GMT+24; date +%d-%b-%Y to get the format of 30-Sep-2008 and TZ=GMT+24; date +%Y%m%d to get the format of 20080930. I need this two format. In my perl script below I need... (4 Replies)
Discussion started by: bulkbiz
4 Replies

9. Shell Programming and Scripting

Refrence Shell variable in Perl code.

:confused: I have 2 files a & b Contents of a are:- -------------------------- This is a Good Boy This is a Good Boy This is a Very Good Boy This is a Good Boy This is a Good Boy --------------------------- The contents of b are ------------------- This is Testing Beta... (5 Replies)
Discussion started by: send2sridhar
5 Replies

10. UNIX for Dummies Questions & Answers

Export command giving Variable Name vs the Value set for the Variable

I'm having an issue when I export within my program. I'm getting the variable name, not the variable value. I have a configuration file (config.txt) that has the values of the variables set as so: set -a export ARCHIVEPOSourceDir="/interfaces/po/log /interfaces/po/data" export... (2 Replies)
Discussion started by: ParNone
2 Replies
Login or Register to Ask a Question