Skip to content

Literal Replace command works incorrectly when the replacement string contains '$' #2951

@friendly-bits

Description

@friendly-bits

Description of the problem or steps to reproduce

Basically I want to replace some variable name in my shell script with another variable name. In shell, to get a value of a variable, the syntax is '$variable'. So for example, i want to replace '$variableA' with '$variableB'.

I'm typing replace -l '$variableA' '$variableB' in micro's command line. micro correctly finds instances of '$variableA' but when i press Y to accept the replacement, what micro actually replaces with is empty string. So it basically deletes the found instance of '$variableA' instead of replacing it with '$variableB'.

I tried escaping the '$' sign in the replacement string with a backslash but then micro just replaces '$variableA' with the backslash.

This is probably not how it's supposed to work, especially when the 'replace' command is invoked in literal mode.

Specifications

Commit hash: c2cebaa
OS: Debian Stretch
Terminal: xterm

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions