File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
1010
1111For a steady stream of TILs, [ sign up for my newsletter] ( https://crafty-builder-6996.ck.page/e169c61186 ) .
1212
13- _ 1190 TILs and counting..._
13+ _ 1191 TILs and counting..._
1414
1515---
1616
@@ -1162,6 +1162,7 @@ _1190 TILs and counting..._
11621162- [ Print A Range Of Lines For A File With Bat] ( unix/print-a-range-of-lines-for-a-file-with-bat.md )
11631163- [ Print Out Files In Reverse] ( unix/print-out-files-in-reverse.md )
11641164- [ Provide A Fallback Value For Unset Parameter] ( unix/provide-a-fallback-value-for-unset-parameter.md )
1165+ - [ Remove A Directory Called ` -p ` ] ( unix/remove-a-directory-called-dash-p.md )
11651166- [ Repeat Yourself] ( unix/repeat-yourself.md )
11661167- [ Saying Yes] ( unix/saying-yes.md )
11671168- [ Search Files Specific To A Language] ( unix/search-files-specific-to-a-language.md )
Original file line number Diff line number Diff line change 1+ # Remove A Directory Called ` -p `
2+
3+ I accidentally created a directory from the terminal called ` -p ` . It is sitting
4+ there next to other directories like ` app ` and ` public ` . I need to get rid of
5+ it. The ` rmdir ` command is the best way to do that.
6+
7+ ``` bash
8+ $ rmdir -p
9+ usage: rmdir [-p] directory ...
10+ ```
11+
12+ Not so fast. ` -p ` is also a valid flag for the ` rmdir ` command. It doesn't know
13+ that I mean it as the name of the directory. So instead, I am missing a
14+ required argument to ` rmdir ` – the directory.
15+
16+ To get this to work, I need to tell ` rmdir ` that I intend ` -p ` as the name of
17+ the directory to remove.
18+
19+ ```
20+ $ rmdir -- -p
21+ ```
22+
23+ The ` -- ` is a command-line convention. It tells the command that anything after
24+ the ` -- ` is not a flag, but instead an argument. This time the ` -p ` directory
25+ will be removed.
You can’t perform that action at this time.
0 commit comments