Is this a known problem? I have a strange problem with source. Sometimes variables are not defined, but functions are.
I have a file a with: function includeFile() { local fileName local needsToExist=true if [[ ${1} == "--notNeeded" ]] ; then needsToExist=false; shift fi if [[ ${#} -ne 1 ]] ; then echo "includeFile [--notNeeded] <INPUT_FILE>" return 1 fi INPUTFILE=${1}; shift if [ -s ${INPUTFILE} -a -f ${INPUTFILE} -a -r ${INPUTFILE} ] ; then source ${INPUTFILE} else if [[ ${needsToExist} != false ]] ; then echo "${INPUTFILE} could not be used" return 1 fi fi } includeFile b In file b I have: declare testVariable="testing" echo ${testVariable} function testFunction { : } When doing: source a The string "testing" is printed and the function testFunction is defined, but the variable testVariable is not defined. When I change in file a the includeFile to source, testVariable is defined. Very strange indeed. Especially there includeFile does a source. I am using bash 4.2.42(1)-release. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof