Skip to content

Commit

Permalink
Added some more notes, so the TIL is more complete.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasbn committed Aug 9, 2024
1 parent 14097f0 commit c80307d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion rm/delete_files_with_names_resembling_cli_options.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@

I have been accomplishing this by using **Perl's** `unlink`, but there is a much simpler solution as pointed out to me by @larsbalker via Twitter.

Use: `--`, which terminates the interpretation of command line flags/options
If you by accident create a file named: `-v` use: `--`, which terminates the interpretation of command line flags/options

`$ rm -- -v`

Thanks @larsbalker

The Perl solution is:

```perl
perl -e "unlink '-v'";
```

## References

- [Twitter](https://twitter.com/jonasbn/status/966336534835269637)

0 comments on commit c80307d

Please sign in to comment.