Unexpected Eof While Looking for Matching '"'

Why I'm getting these Errors - unexpected EOF while looking for matching `)'

Your here document is terminated wrongly; either

  1. start the here document with <<-EOF and indent using tabs or
  2. put EOF on a line without any other characters.

unexpected EOF while looking for matching `' syntax error: unexpected end of file

The problem is with your sed command:


sed \'s/"//g\'

When you have \' this is an escaped single quote. Then you later have a ", and there are no more " characters for the rest of the script. So bash searches the rest of your script for the closing " and fails to find it.

What I believe you meant to do was not escape the single quotes:

sed 's/"//g'

bash: -c: line 0: unexpected EOF while looking for matching ``'

This error:

bash: -c: line 0: unexpected EOF while looking for matching ``'
bash: -c: line 1: syntax error: unexpected end of file

Clearly indicates that whatever command is supposed to be feeding "deployment.sh" to bash, is not doing it correctly.

I would replace the whole "deployment.sh" script with a single echo "foobar" or something equally simple just to make sure that the script runs. Then, I would dump all the environment variables env to see if there's something funky.

Eventually check piece by piece that everything in "deployment.sh" is working correctly, and for starters others have already pointed out you have an issue at the beginning:

This:

echo $AWS_ACCESS_KEY_ID & echo $AWS_SECRET_ACCESS_KEY & echo $AWS_REGION & echo ""

Runs four commands in parallel, and the order of the output isn't guaranteed, which clearly would mess with aws configure.

Instead use a heredoc:

aws configure <<EOF
$AWS_ACCESS_KEY_ID
$AWS_SECRET_ACCESS_KEY
$AWS_REGION

EOF

This shouldn't affect the rest of the script though.

Error : unexpected EOF while looking for matching `''

Try escaping double quotes as follows:

#!/bin/bash

cd /data/NEW
for f in User*
do
mysql --user="root" --password="user@123" -e "LOAD DATA LOCAL INFILE '/data/NEW/$f' ignore into table new.table2 fields terminated by ',' enclosed by '\"' lines terminated by '\n' (table_date, table_name, table_count);"

done

unexpected EOF while looking for matching `''

Try to use:

sudo docker exec $webproxy sh -c "$webproxycurl"

Also, as a side note, do not run docker in sudo.

  • Add the docker group if it doesn't already exist:

     sudo groupadd docker
  • Add the connected user "$USER" to the docker group. Change the user name to match your preferred user if you do not want to use your current user:

     sudo gpasswd -a $USER docker
  • Either do a newgrp docker or log out/in to activate the changes to groups.

  • You can use

     docker run hello-world

    to check if you can run docker without sudo.

Check this answer for more details.



Related Topics



Leave a reply



Submit