"rm: illegal option -- j " when trying to delete a folder that starts with a dash

bash

Solution

Use the `./` prefix to the file name so it does not look like an option argument:

$>rm -rf ./--javascript=jquery
$>ls
awesome_rails_app
$>

I actually found the solution on a blog post at the Electric Toolbox: "Delete a file starting with a dash/hypen on Linux on the command line".

Problem

``` $>ls awesome_rails_app $>rails new --javascript=jquery **Normally, I would treat --javascript=jquery as a command line option...but since you didn't give me a name for your app, I'm assuming you actually want me to generate an app named --javascript=jquery. Here's your new app!** $>ls --javascript=jquery awesome_rails_app $> ``` So obviously, I want to be able to delete this app...but... ``` $>rm -rf --javascript=jquery rm: illegal option -- j usage: rm [-f | -i] [-dPRrvW] file ... unlink file $> ``` What should I do now?

Original source

Related problems