You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
s&a&b& fails with "unterminated substitute replacement" #697
When & is the delimiter of an s command, the replacement never ends:
$ echo a | sed 's&a&b&'
sed: <script argument 1>:1:7: error: unterminated substitute replacement
This should replace 'a' with 'b' and then output 'b'. Other delimiters work, but this one doesn't.
This is because the parser treats '&' as the matched text before it performs the delimiter check. In practice I hit this trying to install a Python version from Pyenv, autoconf's config.status uses '&' as a delimiter for sed, and it was failing. I have a patch ready.
Activity
sed: end an s replacement at an & delimiter
sed: end an s replacement at an & delimiter