Skip to main content
note about smart quotes being harmful
Source Link
telcoM
  • 114.1k
  • 4
  • 163
  • 311

Welcome to Unix & Linux StackExchange!

./fix.sh: line 53: unexpected EOF while looking for matching `"'

This error message can be tricky, as it indicates line 53 of the script, which is where the shell noticed that something is going wrong with double quotes. Usually the actual error is a missing double quote somewhere before that.

The code formatting in your post is already trying to help you. Note that in the code you posted, at first only things within double quotes (") are displayed in red. But after this line, everything else turns red and things within double quotes are black or blue:

trap «rm \»${MyTmpFile}\"; exit 0" 0 1 2 3 15

The change of color scheme means this line has an unpaired double quote (that is not escaped with a backslash). It looks like an incomplete conversion from «...»-style quotes to standard double quotes.

This line should probably be:

trap "rm \"${MyTmpFile}\"; exit 0" 0 1 2 3 15

All the «...»-style quote in the script should probably also be converted to regular double quotes.

When writing scripts, you should never use an editor that replaces regular single or double quotes with "smart quotes" of any kind. Such a replacement will often break the script. If your editor does that, find out how to turn the "smart quotes" feature off.


./fix.sh: line 59: syntax error: unexpected end of file

This message tells you about a problem on line 59, but the script has only 58 lines. So the problem is at the very end of the script. The last line of the script also has an unpaired quote that should be fixed.

Welcome to Unix & Linux StackExchange!

The code formatting in your post is already trying to help you. Note that in the code you posted, at first only things within double quotes (") are displayed in red. But after this line, everything else turns red and things within double quotes are black or blue:

trap «rm \»${MyTmpFile}\"; exit 0" 0 1 2 3 15

The change of color scheme means this line has an unpaired double quote (that is not escaped with a backslash). It looks like an incomplete conversion from «...»-style quotes to standard double quotes.

This line should probably be:

trap "rm \"${MyTmpFile}\"; exit 0" 0 1 2 3 15

All the «...»-style quote in the script should probably also be converted to regular double quotes.

The last line of the script also has an unpaired quote that should be fixed.

Welcome to Unix & Linux StackExchange!

./fix.sh: line 53: unexpected EOF while looking for matching `"'

This error message can be tricky, as it indicates line 53 of the script, which is where the shell noticed that something is going wrong with double quotes. Usually the actual error is a missing double quote somewhere before that.

The code formatting in your post is already trying to help you. Note that in the code you posted, at first only things within double quotes (") are displayed in red. But after this line, everything else turns red and things within double quotes are black or blue:

trap «rm \»${MyTmpFile}\"; exit 0" 0 1 2 3 15

The change of color scheme means this line has an unpaired double quote (that is not escaped with a backslash). It looks like an incomplete conversion from «...»-style quotes to standard double quotes.

This line should probably be:

trap "rm \"${MyTmpFile}\"; exit 0" 0 1 2 3 15

All the «...»-style quote in the script should probably also be converted to regular double quotes.

When writing scripts, you should never use an editor that replaces regular single or double quotes with "smart quotes" of any kind. Such a replacement will often break the script. If your editor does that, find out how to turn the "smart quotes" feature off.


./fix.sh: line 59: syntax error: unexpected end of file

This message tells you about a problem on line 59, but the script has only 58 lines. So the problem is at the very end of the script. The last line of the script has an unpaired quote that should be fixed.

Source Link
telcoM
  • 114.1k
  • 4
  • 163
  • 311

Welcome to Unix & Linux StackExchange!

The code formatting in your post is already trying to help you. Note that in the code you posted, at first only things within double quotes (") are displayed in red. But after this line, everything else turns red and things within double quotes are black or blue:

trap «rm \»${MyTmpFile}\"; exit 0" 0 1 2 3 15

The change of color scheme means this line has an unpaired double quote (that is not escaped with a backslash). It looks like an incomplete conversion from «...»-style quotes to standard double quotes.

This line should probably be:

trap "rm \"${MyTmpFile}\"; exit 0" 0 1 2 3 15

All the «...»-style quote in the script should probably also be converted to regular double quotes.

The last line of the script also has an unpaired quote that should be fixed.