Skip to content

warn about globbing not working inside a herestring / heredoc #3366

@programminghoch10

Description

@programminghoch10

For new checks and feature suggestions

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

#!/bin/bash
cat <<< *
# or
cat <<EOF
*
EOF

Here's what shellcheck currently says:

nothing

Here's what I wanted to see:

a warning that the glob * is used literally and will not be expanded

Additional comments

i guess this could be an optional check as well

i stumbled upon this, because my editor highlighted the * in another color to signal that globbing will happen

globbing also won't work in a heredoc, even though variables do:

#!/bin/bash
cat <<EOF
*
$SHELL
EOF

which could also be warned about,
while i wouldn't warn about this in "plaintext mode":

#!/bin/bash
cat <<'EOF'
*
$SHELL
EOF

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