0

Given that bash hasn't a native goto function, I stumbled upon this comment here a while ago.

And while I get, this is a messy solution, it worked very well for my use cases - until now. A few days ago I discovered that the script in which a had such jump marks suddenly quits with an error:

sed: 1: "/myjumpmark:/{:a;n;p;ba};": unexpected EOF (pending }'s)

That's strange, as I didn't touch the script in a while. What I instead discovered, is that brew (I'm running the script on macOS) updated gnu-sed to version 4.8 in the past days. That's about the time, the problems started.

Now my question is: Is there any significant change in sed 4.8 that causes my previously functioning script to crash? And if so, what should I try to get it to work again?

Andreas
  • 51
  • 1
  • 5
  • 1
    If you don't show the guilty code and what you try to get, it will be hard to find a working solution. – Pierre François Jan 23 '20 at 16:58
  • See [sed gives me ": unexpected EOF (pending }'s) error and I have no idea why](https://stackoverflow.com/questions/15467616) – Wiktor Stribiżew Jan 23 '20 at 17:09
  • Also, you may try `-e` style: `sed -e "/myjumpmark:/{:a" -e n -e p -e ba -e "}"` – Wiktor Stribiżew Jan 23 '20 at 17:15
  • 3
    If you didn't alias your GNU sed from `gsed` to `sed`, you might still call the system sed, which requires an extra `;` before closing braces (or the style with separate `-e` statements, as per Wiktor's comment). Brew update might have broken the symlink. – Benjamin W. Jan 23 '20 at 17:59
  • 1
    Thanks, Benjamin! I'm so sorry, I always called the system sed. Changed it to `gsed` and it works again. Still, no idea why it stopped working from one day to another, but that change did the trick. – Andreas Jan 23 '20 at 18:43

0 Answers0