Bash Variable within variable not being interpreted?
Hello all I am working on the following gibberish script and can't seem to get the $SUBJECT variable to expand during emailing. I attempted to turn the subject into a variable and instead of printing the subject mutt is emailing this email to all words in the subject line.
CANDY=gummy_worm
BREAD=italian
RECIPIENT=someguy@aol.com
OUTPUTDIR=/tmp/somedir
SUBJECT="This was the $CANDY for the baker, he also likes $BREAD"
ARRAY_OF_WORDS=(one two three four)
# Scan loop starts here.
for word in ${ARRAY_OF_WORDS[*]}
do
touch $OUTPUTDIR/"$word"_"$CANDY".html
$MUTTCMD -s $SUBJECT -a somefile.txt $RECIPIENT < /tmp/testmsg.txt >> /dev/null 2>&1
done
I tried enclosing $SUBJECT within single quotes but that do that the variable is not interpreted. Any advice would be great.
Thanks
|