Special Characters – Remove File Named $file

filenamesrmspecial characters

I was working on a shell script and I accidentally created a file with the variable as its name. Now I have $file in my ls output, and cannot remove it. What can I do?

Best Answer

You can escape the $ with \:

rm \$file
Related Question