Skip to content

SC2016 incompatibility with sed command #3301

@IvanGrigorik

Description

@IvanGrigorik

For bugs with existing features

Here's a snippet or screenshot that shows the problem:

#!/bin/bash
sed 's/[][\.|$(){}?+*^]/\\&/g'

Here's what shellcheck currently says:

In btest.sh line 2:
sed 's/[][\.|$(){}?+*^]/\\&/g'
    ^------------------------^ SC2016 (info): Expressions don't expand in single quotes, use double quotes for that.

Here's what I wanted or expected to see:

nothing.

Rationale

sed command can contain as many RegEx signs, as possible. The ShellCheck should ignore internal content of this command.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions