Script Parameter Pass to Another Script

How do I pass a parameter from one script to another script?

dbParam.ini

pUser=Magic
pPwd=Test1234
pNewPwd=HappyMeal

sample2.sh

#!/usr/bin/ksh
. .dbParam.ini
echo "user $pUser"
echo "current password $pPwd"
echo "new password $pNewPwd"

when run

$ sh sample2.sh
sample2.sh: line 2: .: .dbParam.ini: file not found
user
current password
new password

how do I pass a parameter from one script to another script? thanks.

change the string
. .dbParam.ini
on
. dbParam.ini

it did not work.

sh sample2.sh
sample2.sh: line 2: .: dbParam.ini: file not found
user
current password
new password

--- Post updated at 09:25 AM ---

I got it working by changing this line

. .dbParam.ini

to

. ./bParam.ini

sample2.sh

. ./dbParam.ini
echo "user $pUser"
echo "current password $pPwd"
echo "new password $pNewPwd"

when run

sh sample2.sh
user Magic
current password Test1234
new password HappyMeal

The problem is not the passing of a parameter from one script to another it is the usage of relative pathes in scripts. The line:

. .dbParam.ini

is problematic because the validity of relative pathes (here "." or the current directory) is depending on what exactly "the current directory" represents. Try replacing the line with:

. /the/path/to/.dbParam.ini

and it will work regardless of where you right now are when you call the script.

I hope this helps.

bakunin

Apparently you deleted the wrong point. :slight_smile:
Try neatly deleting the point and slash just before the file name ./dbParam.ini ,
leaving only the first dot a space and then the file name . dbParam.ini
Save and exit. Run your script again and share the results please