Skip to content

expr "$x" : '^$y" is not reported as non-posix #3359

@cD1rtX3

Description

@cD1rtX3

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

#!/bin/sh
expr "X$1" : '^Xspecial'

Here's what shellcheck currently says:

Nothing.

Here's what I wanted or expected to see:

Something like “expr already only matches at the start of the string, so the ^ anchor is undefined for it in POSIX sh”.

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