Interpretation of $variables inside programs run from a script

Hi,
I am running a shell script that executes a program. Inside this program, variables are also referenced using a dollar symbol, eg. $a, $thething, and the shell script is misinterpreting them as variables relevant to the shell script rather than relevant to the program run from inside the script. I know that's an incoherent explanation, so here is an illustration of the problem:

#!/bin/bash
#***do something that defines the variable "outside"
outside=do_stuff
specialized_program << RUNIT
inside=process_data $outside
print $inside
RUNIT

The problem is that "print $inside" prints an empty string, rather than the result of "process_data". How can I fix this?

Thanks,
H.

Try quoting the values and then print/echo.

inside="process_data ${outside}"
echo $inside # since i have tried with echo only not print command

In case your are referencing value to variable outside from some other file say file2.txt, then you would need to source the file file2.txt in the above script.

Try this,

#!/bin/bash
#***do something that defines the variable "outside"
outside=do_stuff
specialized_program << RUNIT
inside=`process_data $outside`
print $inside
RUNIT