Skip to content

Incorrect error and suggestion for SC2188 #3393

@balki

Description

@balki

For bugs with existing features

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

#!/usr/bin/bash

token=foo

curl "https://example.com/api/profile" \
	-H @<(<<<"Authorization: Bearer $token")

Here's what shellcheck currently says:

$ shellcheck myscript
 
Line 6:
        -H @<(<<<"Authorization: Bearer $token")
              ^-- [SC2188](https://www.shellcheck.net/wiki/SC2188) (warning): This redirection doesn't have a command. Move to its command (or use 'true' as no-op).

Here's what I wanted or expected to see:

No error.

The purpose of using process substitution here is so that other unprivileged processes don't see the token when doing ps aux | grep curl.
Using true will consume stdin and would not pass it to curl.
I can silence it by adding a cat. like -H @<(cat <<<"Authorization: Bearer $token"). But the cat would be unnecessary.

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