I would like to write multiple lines to a file with the EOT, but the following script
#!/bin/bash
bench="X"
file_name="submit2.sh"
ids=(55)
for id in "${arrayName[@]}"; do
cat <<'EOT' >> $bench/$file_name
#!/bin/bash -l
#PBS -l nodes=1:ppn=1
echo $id
EOT
done # line 11
Gives this error
line 11: warning: here-document at line 6 delimited by end-of-file (wanted `EOT')
line 12: syntax error: unexpected end of file
How can I fix that?
ids=(55)just sets the variable$idto the string55; ii)for id in "${arrayName[@]}"; dowill fail since you don't definearrayNameanywhere; iii) even if that did work, you would still always be writing toX/submit2.sh, since the values of$benchand$file_namenever change. – terdon Sep 13 '22 at 15:03