Quote:
Originally Posted by
maverick1947
Thanks. For your reply here.i have the same issue. But. I am not able to read from the file the same way. Is this external file supposed to b in some format.what I did was aa
Parm.txt has following contents
User="abc"
Pwd="password"
Export $User $Pwd
And script.ksh has
User=$1
Pwd=$2
Then I executed
./script.ksh ./Parm.txt
But it's not working. Please suggest. Thanks in advance.
You dont need to export the variables $User and $Pwd. Just executing the parm script will export the variables.
Consider that there are two files:
Parm.sh
User="abc"
Pwd="password"
script.ksh
Your code
If you want to inherit the values of User and Pwd from the parm.sh into script.ksh, there are two ways to go about doing it:
1. Execute the parm.sh script before executing the script.ksh from the terminal.
$ ./parm.sh
$ echo $User $pwd
$ ./script.ksh
2. The better, more preferred option will be to invoke the parm.sh and its values from within script.ksh as follows:
script.ksh
. ./parm.sh
echo $User $Pwd
**Your code***
In the above example, the variables User and Pwd will be inherited by the script