Linux – How do I keep quotes when outputting shell variables?

How do I keep quotes when outputting shell variables?… here is a solution to the problem.

How do I keep quotes when outputting shell variables?

The following line:

`eval echo echo $VAR=\\$$VAR` >> $FILE

Output to a file named $FILE:

FOO=value_of_full
BAR=value_of_bar

I want to output quotes, for example:

FOO="value_of_full"
BAR="value_of_bar"

I’ve tried using \” and "" but neither works as I expected.

Solution