I am faceing an issue when I want to use variable inside cat <<EOF > Test.html , for example
cat <<EOF > Test.html <!DOCTYPE html> <head> <meta charset="utf-8"> <head> <style type="text/css"> */:root{--blue:#007 etc .. Then <!-- Heading --> <span> $Test </span> </div> etc .. EOF The $Test is not active I mean Bash considered it as a string not variable ( please find attached file )
1 Answer
You have to add escape as shown below:
cat <<\EOF > Test.html echo $var EOF Check the output by cat Test.html.