0

I am getting the below error for my here document:

line 8: warning: here-document at line 4 delimited by end-of-file (wanted `START')

./appendJVM.sh: line 9: syntax error: unexpected end of file

This is the script I am using:

#!/bin/bash
for host in `cat servers.txt`;
do
ssh $host /bin/bash << START
    cd /home/user/jmx/conftest
    echo 'JVM_OPTS="$JVM_OPTS -javaagent:'$PWD/jmx_prometheus_javaagent-0.1.0.jar=7070:$PWD/cassandra.yml'"' >> contestf/cassandra-env.sh
  START
 done
Community
  • 1
  • 1
user9062792
  • 11
  • 1
  • 5
  • Please format your code correctly and add correct tags for the programming language you are using. This question is just awful to look at. – MechMK1 Dec 19 '17 at 12:40

1 Answers1

1

Remove whitespace between between << and START, as well as on the line before your heredoc terminator:

#!/bin/bash
for host in `cat servers.txt`;
do
ssh $host /bin/bash <<START
    cd /home/user/jmx/conftest
    echo 'JVM_OPTS="$JVM_OPTS -javaagent:'$PWD/jmx_prometheus_javaagent-0.1.0.jar=7070:$PWD/cassandra.yml'"' >> contestf/cassandra-env.sh
START
done
ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257