-
Notifications
You must be signed in to change notification settings - Fork 747
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Remove A Directory Called
-p
as a Unix til
- Loading branch information
1 parent
5393195
commit 711310b
Showing
2 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |