I wanted to do a bash function that given a text variable, it would concatenate it to a file. i.e
function print() {
cat << 'EOF' >> file
This $1 is a variable
EOF
}
But it wouldnt work. It would always output This $1 is a variable
.
I tried ${1}
, {$1}
, '$1'
, "$1"
,and combinations of those, none worked. Is there some sort of special syntax, or should I use another command... what should I do?