How to echo variables using cat into file?
22,822
Drop the single quotes around the here-document limit string EOF
to avoid suppressing parameter substitution. More details here.
Especially take note of "Example 19-7. Parameter substitution turned off" and "Example 19-8. A script that generates another script".
Related videos on Youtube
Author by
myWallJSON
Updated on September 18, 2022Comments
-
myWallJSON over 1 year
I have simple script like this:
#!/bin/bash BOO=bla-bla-bla cat > ./Makefile <<'EOF' Hello INCLUDES := -I/data/opt/include/ -Ideps/ -I$BOO/include EOF
Yet it outputs into file:
Hello INCLUDES := -I/data/opt/include/ -Ideps/ -I$BOO/include
how to make
cat
use my variables values, not names inside that string? -
Mathias Begert over 10 years@sukminder, thank you. Will keep this in mind going forward