mirror of
https://github.com/jbranchaud/til
synced 2026-01-18 22:48:02 +00:00
Add Remove A Directory Called -p as a Unix til
This commit is contained in:
@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
|
|||||||
|
|
||||||
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
|
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
|
||||||
|
|
||||||
_1190 TILs and counting..._
|
_1191 TILs and counting..._
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -1162,6 +1162,7 @@ _1190 TILs and counting..._
|
|||||||
- [Print A Range Of Lines For A File With Bat](unix/print-a-range-of-lines-for-a-file-with-bat.md)
|
- [Print A Range Of Lines For A File With Bat](unix/print-a-range-of-lines-for-a-file-with-bat.md)
|
||||||
- [Print Out Files In Reverse](unix/print-out-files-in-reverse.md)
|
- [Print Out Files In Reverse](unix/print-out-files-in-reverse.md)
|
||||||
- [Provide A Fallback Value For Unset Parameter](unix/provide-a-fallback-value-for-unset-parameter.md)
|
- [Provide A Fallback Value For Unset Parameter](unix/provide-a-fallback-value-for-unset-parameter.md)
|
||||||
|
- [Remove A Directory Called `-p`](unix/remove-a-directory-called-dash-p.md)
|
||||||
- [Repeat Yourself](unix/repeat-yourself.md)
|
- [Repeat Yourself](unix/repeat-yourself.md)
|
||||||
- [Saying Yes](unix/saying-yes.md)
|
- [Saying Yes](unix/saying-yes.md)
|
||||||
- [Search Files Specific To A Language](unix/search-files-specific-to-a-language.md)
|
- [Search Files Specific To A Language](unix/search-files-specific-to-a-language.md)
|
||||||
|
|||||||
25
unix/remove-a-directory-called-dash-p.md
Normal file
25
unix/remove-a-directory-called-dash-p.md
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# Remove A Directory Called `-p`
|
||||||
|
|
||||||
|
I accidentally created a directory from the terminal called `-p`. It is sitting
|
||||||
|
there next to other directories like `app` and `public`. I need to get rid of
|
||||||
|
it. The `rmdir` command is the best way to do that.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ rmdir -p
|
||||||
|
usage: rmdir [-p] directory ...
|
||||||
|
```
|
||||||
|
|
||||||
|
Not so fast. `-p` is also a valid flag for the `rmdir` command. It doesn't know
|
||||||
|
that I mean it as the name of the directory. So instead, I am missing a
|
||||||
|
required argument to `rmdir` – the directory.
|
||||||
|
|
||||||
|
To get this to work, I need to tell `rmdir` that I intend `-p` as the name of
|
||||||
|
the directory to remove.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ rmdir -- -p
|
||||||
|
```
|
||||||
|
|
||||||
|
The `--` is a command-line convention. It tells the command that anything after
|
||||||
|
the `--` is not a flag, but instead an argument. This time the `-p` directory
|
||||||
|
will be removed.
|
||||||
Reference in New Issue
Block a user