Page 1 of 1

bash error tip `"' -> {

Posted: 19 Nov 2023, 03:22
by Ed_P
If you run a script you've tweaked and get this:

Code: Select all

guest@porteus:~$ ./mkmods/mkmod50nemobkmks.sh
./mkmods/mkmod50nemobkmks.sh: line 82: unexpected EOF while looking for matching `"'
./mkmods/mkmod50nemobkmks.sh: line 114: syntax error: unexpected end of file
guest@porteus:~$ 
Don't waste time looking for `"' or each character individually. The fix was replacing "${DRV" with "$DRV" on line 12. :shock:

It took me 2 hrs to find the fix. A dumb copy & paste error. :wall:

A more useful error message would have been:

Code: Select all

./mkmods/mkmod50nemobkmks.sh: line 82: unexpected EOF while looking for matching }

bash error tip `"' -> {

Posted: 26 Nov 2023, 05:13
by Rava
From man bash
Have you tried

Code: Select all

       --debugger
              Arrange for the debugger profile to be executed before the shell
              starts.  Turns on extended debugging mode (see  the  description
              of the extdebug option to the shopt builtin below).
and/or

Code: Select all

xtrace  Same as -x.
?

bash error tip `"' -> {

Posted: 26 Nov 2023, 07:00
by Ed_P
Rava wrote:
26 Nov 2023, 05:13
Have you tried

Code: Select all

       --debugger
No. Don't know where to put it in a script.
Rava wrote:
26 Nov 2023, 05:13
and/or

Code: Select all

xtrace  Same as -x.
No. Don't know where to put it in a script.

To debug I use:

Code: Select all

set -x;
:)

bash error tip `"' -> {

Posted: 26 Nov 2023, 14:59
by Rava
set -x is a good start.
And welcome to coding hell when it comes to bugs in your code. The error output is often not that specific.
But that is where either your own knowledge and coding skills kick in. Or a specialised forum like Stack Overflow where there are folks much more knowledgable than you and me put together pointing out the errors of our way :D error(s) in our code. :)

bash error tip `"' -> {

Posted: 26 Nov 2023, 16:00
by Ed_P
:) :happy62: :friends: