-7
15

What is it saying in my terminal ?

12h 27m ago by retrofed.com/u/LoveEspresso in explainlikeimfive from retrofed.com

$ 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.

They are using fish, FYI. Not sure how much of a difference this makes.

Fish is different ?

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.

The actual folder is 'folder'$'\003' .

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

Thanks for the tip.

Is this some school task...? Why is there a folder with such a name 😅

Apparently yes. I'm learning things on my own.

how did you decide which parts to quote..?

I simply copied down the commands in the lesson.

fish expected a variable name after $

This syntax works for me on Bash and Zsh. Your shell might have a different way of writing escape sequences.

Bash and Zsh are identical ??

They are not identical, but more they are quite compatible, most of Bash syntax and built-in commands work on Zsh as well. From what I’ve heard, Fish differs from them a lot. I use primarily Zsh, but sometimes run Bash if I need it for something (before ** started working on Zsh, I used Bash globstar when I needed it, for example).