Check balanced double quotes…
…or any other character!
Why? Usually I have the problem that writting shell scripts I miss some double (or single) quotes.
If script is short I can easily find where the error is but with long scripts that is not easy.
So I wrote following command to find rows with odd number of double quotes.
cat -n <script> | sed -e s/'[^”]’/”/g -e s/'””‘/”/g -e s/’$’/’X’/1 | cat -n | sed -e /'[[:digit:]][[:space:]]X$’/d
Output could be:
Saying that row 1242 has a problem with double quotes number.
It is possible to replace double quotes in [^”] and s/'””‘/”/g with any other character you want check if it is balanced.