This command doesn't seem to work in my script, how can I decide in which file I want this text, if I just create a file with the following command
touch $name
I want the text to be in the file $name
that I just made in my script.
cat <<'EOF'
Data...
EOF
$( do something here )
, but I wouldn't. It gets indeciphrable/messy/incomprehensible quickly. Do the comparisons outside of thehere
document part and insert text there via variables for example or maybe better: compose the text bit by bit. – Tomáš Pospíšek Dec 28 '17 at 09:43cat <<'EOF' >>$name $(if (($read == yes)))... EOF
– florian de wulf Dec 28 '17 at 09:47if ...; then echo "foo" >> $name; fi; cat << EOF ...
– Tomáš Pospíšek Dec 28 '17 at 09:48$name
needs to be quoted. e.g."$name"
. See https://unix.stackexchange.com/a/65633/7696 for a good summary of why variables should (almost) always be quoted. – cas Dec 28 '17 at 10:04