Skip to content

Bug ? SC2086 - false positiv due to bash arithmetic ?! #2364

@PeterPitterling

Description

@PeterPitterling

For bugs

For new checks and feature suggestions

Maybe similar to "retryLimit appears unused" but its used.

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

#!/usr/bin/env bash

declare -i prefix_length=0

(( prefix_length += 17 ))                      #triggers SC2086 in next line

printf '%-*b\n' ${prefix_length} 'same string with long prefix'

Here's what shellcheck currently says:

Line 7:
printf '%-*b\n' ${prefix_length} 'same string with long prefix'
                ^-- SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: (apply this, apply all SC2086)
printf '%-*b\n' "${prefix_length}" 'same string with long prefix'

Here's what I wanted or expected to see:

No error message

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