i have 1 file say
LogDirectory='/var/tmp/logs'
DataDirectory='/var/tmp/data'
DBUSER='scott'
now i want to access these variables in many files where
#!/bin/bash
${DBUSER} , ${DataDirectory}
are called how do i do that?
i have 1 file say
LogDirectory='/var/tmp/logs'
DataDirectory='/var/tmp/data'
DBUSER='scott'
now i want to access these variables in many files where
#!/bin/bash
${DBUSER} , ${DataDirectory}
are called how do i do that?
Use like this..
LogDirectory='/var/tmp/logs'
DataDirectory='/var/tmp/data'
DBUSER='scott'
#!/bin/bash
echo $LogDirectory
cd $DataDirectory
#You can use this variable how you want - its your choice. just add $ in front of the variable...
Just source the file in your scripts at the beginning:
#!/bin/bash
. varfilename
echo ${DBUSER} , ${DataDirectory}