How to properly nest Bash backticks
Solution 1:
Use $(commands)
instead:
$ echo "hello1-$(echo hello2-$(echo hello3-$(echo hello4)))"
hello1-hello2-hello3-hello4
$(commands)
does the same thing as backticks, but you can nest them.
You may also be interested in Bash range expansions:
echo hello{1..10}
hello1 hello2 hello3 hello4 hello5 hello6 hello7 hello8 hello9 hello10
Solution 2:
if you insist to use backticks, following could be done
$ echo "hello1-`echo hello2-\`echo hello3-\\\`echo hello4\\\`\``"
you have to put backslashes, \\ \\\\ \\\\\\\\
by 2x and so on, its just very ugly, use $(commands)
as other suggested.