Skip to content

Files

Latest commit

 

History

History
32 lines (19 loc) · 837 Bytes

SC2247.md

File metadata and controls

32 lines (19 loc) · 837 Bytes

Pattern: Use of $"( or $"{

Issue: -

Description

This is most likely due to flipping the dollar-sign and double quote:

echo $"(cmd)"  # Supposed to be "$(cmd)"
echo $"{var}"  # Supposed to be "${var}"

Instead of quoted substitutions, these will be interpreted as localized string resources ($"..") containing literal parentheses or curly braces. If this was not intentional, you should flip the " and $ like in the example.

Example of incorrect code:

var=$"(whoami)"

Example of correct code:

var="$(whoami)"

Exceptions:

If you intentionally wanted a localized string literal $".." that starts with ( or {, either ignore this error or start it with a different character.

Further Reading