I am trying to generate a file using cat in bash where inside the bash, i already ran a script, that i saved into a variable then will be used inside the cat. To ran the script and save the output to a variable, I used the following:
declare RESULT=$(./script.pl 5 5 5)
Next, I show an excerpt of the cat file where the variable RESULT is being used.
cat> input.in<<EOF
bla bla
echo $RESULT
EOF
What I obtain after running the bash, is the correct output of the variable RESULT. However, there is a word echo in the beginning of the file (as shown below). This is problematic because I am trying to automate a code, and adding the word echo ruins the code.
echo K_POINTS crystal
64
0.00000000 0.00000000 0.00000000 1.562500e-02
0.00000000 0.00000000 0.25000000 1.562500e-02
0.00000000 0.00000000 0.50000000 1.562500e-02
Can you tell me please what is the problem? Thanks a lot!