[NTLUG:Discuss] OT - include bash script

Greg Edwards greg at nas-inet.com
Tue Jan 5 15:22:24 CST 2010


Is it possible to have a bash script include code from another file and 
maintain vars set by the parent script?

example:

parent script:

   message="hello world"
   $include child.inc

child.inc:

   echo The message of the day is $message

The $include directive pulls the code fine, but vars set by the parent 
are lost.  In the above example $message is empty.

-- 
Greg E



More information about the Discuss mailing list