passing a value


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers passing a value
# 1  
Old 09-18-2001
passing a value

I am trying to write a program that calls two differant scripts. One sets a variable's value and the other one needs to be able to access that value. Can I pass the variable back to the program from the first script?
# 2  
Old 09-18-2001
No, you can't do that. Each script is running in a seperate shell. When that shell exits, the variable disappears.

Are the two scripts being invoked by a third script rather than a program? The first script could, as it finishing, simply "echo $var" to send the value to standard out. The main script can capture this value using backticks or $( ). Then it can feed it into the second script as an argument.
# 3  
Old 09-18-2001
It is a Progress program, which calls the first script and then immediately calls the next one. Does anyone work with Progress on Unix? Is it possible to send a value to the program that I can then send to the next script?
# 4  
Old 09-18-2001
I guess this means that you can't change the way the scripts are invoked. That is a major bummer.

Well, it's ugly, but the first script could write the value to a file. And the second script could read that file.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Passing Variables

I have below data: DAY1=10202013 I am trying below but not getting the desired output: COUNT=1 DATE=DAY$COUNT echo "Date is $DATE" However output I am getting is: Date is DAY1 I wanted the output as: Date is 10202013 I tried following as well: DAY1=10202013 COUNT=1... (3 Replies)
Discussion started by: rockyr1985
3 Replies

2. Shell Programming and Scripting

Passing parameter more than 9

Hi, I've written a script where eleven parameter to be passed from command line which is inserting into an oracle table, it is working but the tenth and 11th parameter are not accepting as given it is referring to 1st parameter. HERE IS THE SCRIPT #!/bin/ksh #set -o echo $*... (4 Replies)
Discussion started by: sankar
4 Replies

3. Shell Programming and Scripting

Reading a string and passing passing arguments to a while loop

I have an for loop that reads the following file cat param.cfg val1:env1:opt1 val2:env2:opt2 val3:env3:opt3 val4:env4:opt4 . . The for loop extracts the each line of the file so that at any one point, the value of i is val1:env1:opt1 etc... I would like to extract each... (19 Replies)
Discussion started by: goddevil
19 Replies

4. UNIX for Dummies Questions & Answers

Passing arguments

I need to pass arguments to a shell script.My batch is calling some java program. ################# x=$1 y=$2 java -classpath program ################### if first parameter and second parameter is null then java -classpath program if first parameter is not null and second parameter is... (3 Replies)
Discussion started by: mnjx
3 Replies

5. Shell Programming and Scripting

Passing Arguments-Help

Hi, I have a script which adds the user credentials to an ldap server. Im passing the variables as below.. /path/my_script $uname $pwd $environ ${deposit} If i enter some special characters like ';' in $pwd, script returns an error which is set to display if the user enters... (5 Replies)
Discussion started by: Tuxidow
5 Replies

6. Shell Programming and Scripting

passing value through ftp

how to pass value through FTP.Below the script in k-shell echo "Enter the month/day" read value ftp -v -n ddcappip031.tu.com << "EOF" user amit jason prompt cd /ednpdtu7/u01/pipe/Incoming/CurrentCollector/MeterReads/backupfiles mget CurrentCollectorMeterReadBackup2008'$value'.tar.gz... (13 Replies)
Discussion started by: ali560045
13 Replies

7. Shell Programming and Scripting

passing Argument

Hi All, i have script like below.. echo "1) first option" echo "" echo "2) second option" echo "" echo "*) please enter the correct option" read select case $select in 1) echo "first option selected" ;; 2) echo "second option selected" ;; *) echo "please enter the correct... (4 Replies)
Discussion started by: Shahul
4 Replies

8. UNIX for Advanced & Expert Users

Passing a password to su

Hi I am running unix commands through Oracle, but I want to be able to run sftp which oracle cannot use. What I want to do is run a script which runs as oracle user but has the su command in, to connect as another user that has sftp access. I am trying the below. su - dwintuser -c gary.ksh... (2 Replies)
Discussion started by: colesga
2 Replies

9. Shell Programming and Scripting

Help in passing argu

These are the files avaible in directory file_1.txt file_2.txt .. file_n.txt how are the command to get the files starting with <file> and how to know the count of total files in the folder. I am writing a commond and based on number of n Value i want to execte a command, therefore how to... (2 Replies)
Discussion started by: u263066
2 Replies

10. Shell Programming and Scripting

passing variables

Hi, Is there any way to pass variable to a sed script.For awk we have -v option.like that do we have any way to pass variable to a sed script from a awk script or from normal script? Thanx, sounder (1 Reply)
Discussion started by: sounder123
1 Replies
Login or Register to Ask a Question