Skip to content

String escapes like ''\${1+x} should not be touched #442

@cormacrelf

Description

@cormacrelf

For example

bashString = ''
    if [[ -z ''\${1+x} ]]; then echo "no arg supplied"; fi
'';

Is currently reformatted to

bashString = ''
    if [[ -z ''\${1 + x} ]]; then echo "no arg supplied"; fi
'';

which is invalid bash. (${1+x} is a modifier a bit like ${1:-}). The correct formatting is to leave it exactly as-is because it's not a ${} substitution with a nix expression inside, the $ is escaped.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions