Skip to content

Warn about capturing empty output; var=$(cmd &>/dev/null) #408

@knirch

Description

@knirch

Noticed in a refactoring branch that the behaviour for SC2069 had changed so I didn't need disable statements surrounding my valid uses anymore, which got me thinking. Wouldn't a checker for code like this make sense;

foo=$(cmd >/dev/null)
foo=$(cmd >/dev/null 2>&1)
foo=$(cmd &>/dev/null)
foo=$(cmd >&/dev/null)
cmd >/dev/null | cmd
cmd >/dev/null 2>&1 | cmd
cmd &>/dev/null | cmd
cmd >&/dev/null | cmd
# etc.. (sorry for the sloppy edits)

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