• gravitas_deficiency@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    5
    ·
    edit-2
    19 hours ago

    $ indicates that the string following is an env variable, but you just have a closing quote, so bash is confused.

    If you want the literal character $ in your command, you must escape it: \$

    Edit: afaik my answer does not change based on the fact that this is fish instead of bash or zsh. The $ is outside of the single quotes, and is thus being interpreted as an env var anchor.

        • Strider@lemmy.world
          link
          fedilink
          English
          arrow-up
          1
          ·
          19 hours ago

          Of course. It could work totally different from bash.

          To be fair I saw some cool fish stuff and thought about using it but when maintaining a few thousand servers with bash its not viable to load an alternative shell to all of them.

        • gravitas_deficiency@sh.itjust.works
          link
          fedilink
          English
          arrow-up
          7
          ·
          edit-2
          19 hours ago

          In that case, I think you want

          rm -rf "'folder'\$'\\003'"
          

          Note the double escape before 003, which will render to the character literal \

          Alternatively, start typing

          rm -rf \'fo
          

          And then hit tab until fish autocompletes the directory you want to kill, and run it.

          Side note: i would absolutely not tolerate directories named like that lol