Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

bash

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

like image 630
Left SE On 10_6_19 Avatar asked Dec 08 '22 18:12

Left SE On 10_6_19


1 Answers

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

like image 68
Left SE On 10_6_19 Avatar answered May 21 '23 13:05

Left SE On 10_6_19