When the shell encounters a string between backquotes

     cmd

it executes cmd and replaces the backquoted string with the standard output of cmd, with any trailing newlines deleted. Quoting inside backquoted commands is somewhat complicated, mainy because the same token is used to start and to end a backquoted command. As a consequence, to nest backquoted commands, the backquotes of the inner one have to be escaped using backslashes, e.g.
 LABNAME=$(echo$labname | tr "[a-z]" "[A-Z]" | sed 's/-/_/g' cat <<-IOTA >$iota_cfg path=\checkpath\ export${LABNAME}_COOLXDIR=\$COOLXDIR IOTA

Since the LABNAME is a variable defined out of the here document, it must be quoted by braces {}, or error will occur.

--------------

Reference: