Results 1 to 4 of 4
Hello all,
I have written Two scripts as Follows
First script name- input
#!/bin/sh
#Variable Declaration
Tv=pinnacle
FT=Europe
server=192.168.0.5
second Script name - output
#!/bin/sh
echo " My tv is ...
- 09-24-2008 #1Just Joined!
- Join Date
- Feb 2008
- Posts
- 45
variables From One Script to Another script
Hello all,
I have written Two scripts as Follows
First script name- input
#!/bin/sh
#Variable Declaration
Tv=pinnacle
FT=Europe
server=192.168.0.5
second Script name - output
#!/bin/sh
echo " My tv is - $Tv"
echo " My Ft is - $FT"
echo " MY server is -$server"
My problem is - when i execute second script name output ...echo command showing blank or new line .
Requirement - I need to take all the variable inputs from script one ,execute in second script.( it mean when i do ./output it must echo all the declaration)
Is this Possible?
If YES how ?
If NO , what is the alternate Solution ?

Please help
Thanks
- 09-24-2008 #2Linux Newbie
- Join Date
- Jul 2008
- Posts
- 181
Source the file with the declarations using the "." command.
- 09-24-2008 #3Just Joined!
- Join Date
- Sep 2008
- Posts
- 20
yeah, that means in output file, put this line at the beginning:
Code:source /path/to/input
- 09-24-2008 #4Linux Guru
- Join Date
- Nov 2007
- Location
- Córdoba (Spain)
- Posts
- 1,513
Either source one script into another, or pass the relevant variables as parameters and reference them positionally on the second script ($1...).


Reply With Quote