pass variables from one script to another


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting pass variables from one script to another
# 1  
Old 12-11-2008
pass variables from one script to another

HI all

I am calling a script "b" from script "a". In script "a", i connect to database and get month and year. I have to pass these same values to script b. How can i do that. How can i pass parameters from one script to another
# 2  
Old 12-11-2008
export the variables
export a=100
and all child processes will be able to use a
# 3  
Old 12-11-2008
if i export variable with name "K", that will be placed in environment file and i can use it.

but after the first script "a" executes, i will export the variable and the script "a" may run for days and after some days script "b" will be executed form "a". In the mean time, if others export their own variable with the same name, will it be overwritten and dont i lose the variables value
# 4  
Old 12-12-2008
Quote:
Originally Posted by vasuarjula
In the mean time, if others export their own variable with the same name, will it be overwritten and dont i lose the variables value
It will not be overwritten. Variables will be available only to the session where it is declared and only for the current and sub shells
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to pass variables into anothother variables?

Below are three variables, which I want to pass into variable RESULT1 username1=userid poihostname1=dellsys.com port1=8080 How can I pass these variables into below code... RESULT1=$((ssh -n username1@poihostname1 time /usr/sfw/bin/wget --user=sam --password=123 -O /dev/null -q... (4 Replies)
Discussion started by: manohar2013
4 Replies

2. Shell Programming and Scripting

How to write config shell script to pass variables in master shell script?

Dear Unix gurus, We have a config shell script file which has 30 variables which needs to be passed to master unix shell script that invokes oracle database sessions. So those 30 variables need to go through the database sessions (They are inputs) via a shell script. one of the variable name... (1 Reply)
Discussion started by: dba1981
1 Replies

3. UNIX for Dummies Questions & Answers

How to write Config shell script to pass variables in master shell script?

Dear Unix gurus, We have a config shell script file which has 30 variables which needs to be passed to master unix shell script that invokes oracle database sessions. So those 30 variables need to go through the database sessions (They are inputs) via a shell script. one of the variable name... (1 Reply)
Discussion started by: dba1981
1 Replies

4. UNIX for Dummies Questions & Answers

Pass variables from a text file to a shell script

Hi, I have a text file as follows: a.txt ------ STEPS=3 STEP_DURATION=100 INTERVAL=60 I want to use these values in a shell script. How to go about this? (3 Replies)
Discussion started by: akarnya
3 Replies

5. Shell Programming and Scripting

how to pass variables to s3cmd in a script file

Hi All, How to pass the variable to s3cmd put command? I'm trying to use this command in a script as below: s3cmd put ${upload_path} s3://${upload_dest} where With the above command in script, the file is not getting uploaded. Please help!!! (4 Replies)
Discussion started by: mjavalkar
4 Replies

6. Shell Programming and Scripting

Pass variables to a Unix script from a file

Hi, I am running a Java program from a unix script. I need to pass a variable to the Java code from a file. Here are teh details: cat Parm <<this is my Parameter file>> queuename=queue1 and my shell script is : #!/bin/ksh . ./Parm /opt/java1.5/bin/java -classpath ./java.jar... (1 Reply)
Discussion started by: sangharsh
1 Replies

7. Shell Programming and Scripting

pass perl variables to shell script

I have a perl script that opens a text file containing numbers on each line: for example: 755993 755994 755995 755996 755997 755998 The perl script takes these numbers and store them as an array @raw_data, where I can access individual numbers by using $raw_data for the value 755993.... (2 Replies)
Discussion started by: xchen89x
2 Replies

8. Shell Programming and Scripting

how to pass variables from Asterisk to a C-script

Hi!I'm trying to write a script in C that Asterisk must call: I would to pass to the script a number digited by the user, make some elaboration with it and then pass the result to Asterisk. I don't understand the mechanism used by Asterisk to pass variable to/from a script: I know that variables... (1 Reply)
Discussion started by: lucio82
1 Replies

9. Shell Programming and Scripting

How to pass variables to FUNCTION ?

Hi... Actually, I want to pass a few variables to the function and print it. But, its looks like not working. Could some body help me how could i do that ?... below is my program... #!/usr/bin/ksh usage() { echo "Usage: $0 -n -a -s -w -d" exit } rename() { echo "rename $1 $2"... (5 Replies)
Discussion started by: bh_hensem
5 Replies

10. Shell Programming and Scripting

Pass multiple variables to SQL script

I am trying to close of multiple users in an Oracle database. Each users has records in multiple tables what I need to do is use a script that call each SQL seperately passing either CLI arguments or gathered arguments from the users during run time. ## Accept variable(s) from the command line... (1 Reply)
Discussion started by: jagannatha
1 Replies
Login or Register to Ask a Question