Note that in nano, if there is open quotes, the rest of the line with the open quote will be colored grey, otherwise if all the quotes are closed the line looks yellow. Initially when I copy+pasted these commands into this file from Windows via SSH, there was quite a few grey lines as some of the filenames had apostrophes in them, which I fixed manually by putting a backslash before each apostrophe.
Before running the script, I made sure to run dos2unix on the .sh file so that issues with Windows carriage return don’t cause issues. It made no difference to the errors.
extract.sh: line 64: unexpected EOF while looking for matching `‘’
extract.sh: line 65: syntax error: unexpected end of file
It’s probably something simple, but should be on/around line 64/65. Look for unescaped quotes, you might have a ’ in one of the filenames? Hard to say without actually having the file to look at myself.
I checked very thoroughly that this is not the case. There was 3 unescaped quotes in the file that I went through and fixed.
I’m suspecting that this may be just misleading debug data, as it does not give me errors if I just delete the whole directory structure before each extraction. I think it’s basically saying “restic refuses to try to merge this folder” but in very unrelated terms.
I should have copied the whole command, now I changed the script to something quite different so I don’t think I will get a similar error. I do know that clearly the last line didn’t fix it. Literally the entire script was in the screenshot and all lines were yellow, which should mean all quotes are closed properly.
Alright, well next time it might be a good idea to isolate the problem to the line that triggers it. That will give you information so you can focus on that specific line and hopefully find the cause. What nano thinks of the contents of the file is not synonymous with what bash things about the contents of the file, hence you need to focus on the latter (IMO).
The debug info was simply not helpful. It would default to the last line regardless of what was at the end. Repeatedly I ran dos2unix, or swapped lines around, or deleted the last line, and it always told me unexpected EOF at the last line.