![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| passing variables to sed function in a script .... | shweta_d | Shell Programming and Scripting | 2 | 06-05-2007 03:13 AM |
| passing two variables into a shell script? | Bashar | Shell Programming and Scripting | 2 | 05-15-2007 07:00 AM |
| passing variables to sed inside script | Daniel234 | Shell Programming and Scripting | 5 | 11-24-2005 03:15 AM |
| passing variables to awk from ksh script | rein | Shell Programming and Scripting | 3 | 08-11-2005 08:29 AM |
| Passing filenames/variables into a script | MrToast | Shell Programming and Scripting | 5 | 03-02-2004 07:15 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi there,
I am trying to write a script (lets call it "script 1") which askes the user for information which is then set as a variable within script 1. Further on within this script, I would like to call another script (script 2) and pass the variables from script 1 to script 2. Having just read around the board, I have learnt that it is not possible to pass variables directly between scripts, however I understand that it may be possible "dump" the variables from script 1 into a file and then get script 2 to read them. Question is (if you have not guessed already!!) is how?? Many thanks in advance. TOM P.S. This is not homework or school related in any way!!!!! I am simply a novice |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
There are ways to pass variables to a new script from you existing script. When you start a script you can send variables in the following manner : filename variable variable variable
Unix sees the variable as $1 $2 $3 .... Your second script would then be able to use the variable by thier number or you can assign them a name within the script. Example. Script one: echo $1 {fullpathname}/scripttwo $2 $3 Script Two: echo "this is the second script" echo $1 echo $2 If the user entered scriptone this is fun the computer would respond this this is the second script is fun As you can see you send the second and third variable to scripttwo. Script two sees this as the first and second variable sent to it for processing. Hope this helps |
|
#3
|
|||
|
|||
|
Excellent!!!
Thank you for your prompt answer!!! |
|||
| Google The UNIX and Linux Forums |