The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
NEW: need help with nawk using -v vars wakhan Shell Programming and Scripting 20 04-26-2008 04:44 AM
Passing variables between scripts bbergstrom74 Shell Programming and Scripting 4 01-14-2008 03:31 AM
Passing variables between scripts... Jazmania UNIX for Dummies Questions & Answers 1 09-19-2007 05:48 AM
Passing and using arguments in Scripts. David.Vilmain Shell Programming and Scripting 1 11-13-2006 05:32 PM
need help with nawk using -v vars amon Shell Programming and Scripting 3 01-26-2006 06:23 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-22-2006
rcunn87 rcunn87 is offline
Registered User
  
 

Join Date: Jun 2006
Posts: 24
Passing Vars between scripts

Im running a script that runs scripts within it self and i need to pass vars made in the original script to scripts run within it and the only way i can think to do it is right the string to a file and read the file in the script
  #2 (permalink)  
Old 06-22-2006
rcunn87 rcunn87 is offline
Registered User
  
 

Join Date: Jun 2006
Posts: 24
email me if you know anything

read the rules about email

Last edited by RTM; 06-22-2006 at 01:13 PM..
  #3 (permalink)  
Old 06-22-2006
RTM's Avatar
RTM RTM is offline Forum Advisor  
Hog Hunter
  
 

Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
In the original script, when calling another script:

var1="`hostname`"
/mydir/my-other-script $var1
  #4 (permalink)  
Old 06-22-2006
Doc_RuNNeR Doc_RuNNeR is offline
Registered User
  
 

Join Date: Jun 2006
Posts: 17
Maybe i can function

$. principal_script var1 var2 var3 ......
........................
. subscript1 $var1 $var3
.......................
. subscript2 "$@" #if you like to pass all var

Bye
  #5 (permalink)  
Old 06-23-2006
grial's Avatar
grial grial is offline Forum Advisor  
El UNIX es como un toro
  
 

Join Date: Jun 2006
Location: Madrid (Spain)
Posts: 531
I the main script, export those variables you want others to see:
Code:
#this is main script
export VAR1="value_var1"
./script.sh
VAR1 will be available to ./script1.sh
(for bash)

Regards.
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 10:48 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0