Hi Gurus,
Iam new to Unix.
I had a requirement where i should use a file for example
Host.sh or Host.txt
Host = 555.254.45.14
username = aaaa
pwd = SSSSSS123
And this file need to be used in different scripts.
For example i have script1.sh
where i want to use the values of Host,username & pwd to connect
and similarly in other scripts like script2.sh and script3.sh
So, please provide any example scripts or other info
porter
December 14, 2007, 5:48pm
2
if you export them, any child script will see them.
Otherwise pass as command line arguments.
Can just give me example script
how to export in shell script
porter
December 14, 2007, 5:59pm
4
contents of host.sh
Host=555.254.45.14
username=aaaa
pwd=SSSSSS123
contents of script1.sh
#!/bin/sh
. ./host.sh
# if they are needed by sub scripts then...
export Host
export username
export pwd
echo Host is $Host
echo username is $username
echo pwd is $pwd
..... use as appropriate ...
porter:
contents of host.sh
Host=555.254.45.14
username=aaaa
pwd=SSSSSS123
contents of script1.sh
#!/bin/sh
. ./host.sh
# if they are needed by sub scripts then...
export Host
export username
export pwd
echo Host is $Host
echo username is $username
echo pwd is $pwd
..... use as appropriate ...
wht exactly we should use here ". ./host.sh"
complete path where host.sh is there or just space ./host.sh
Thanks fr ur prompt response
iam naive in unix
porter
December 14, 2007, 6:14pm
7
dot space path-to-host.sh
the dot and space are part of the syntax for running a script in the current process.