Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ For those implemented options, safe-rm will act **exactly the same** as the orig
| `-f`, `--force` | **Force** | Removes files without prompting for confirmation, ignoring nonexistent files and overriding file protections |
| `-r`, `-R`, `--recursive`, `--Recursive` | **Recursive** | Removes directories and their contents recursively. Required for deleting directories |
| `-v`, `--verbose` | **Verbose** | Displays detailed information about each file or directory being removed |
| `-d`, '--directory' | **Remove Empty Directories** | `safe-rm` can check and only remove empty directories specifically with this flag |
| `-d`, `--directory` | **Remove Empty Directories** | `safe-rm` can check and only remove empty directories specifically with this flag |
| `-p`, `--permanently` | **Permanently remove** | Permanently remove files like in traditional `rm` |
| `--` | **End of Options** | Used to indicate the end of options. Useful if a filename starts with a `-` |

Combined short options are also supported, such as
Expand Down
8 changes: 7 additions & 1 deletion bin/rm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,6 @@ for arg in ${ARG[@]}; do
OPT_INTERACTIVE_ONCE=1; debug "$LINENO: interactive_once : $arg"
OPT_INTERACTIVE=;
;;

# both r and R is allowed
-[rR]|--[rR]ecursive)
OPT_RECURSIVE=1; debug "$LINENO: recursive : $arg"
Expand All @@ -314,6 +313,13 @@ for arg in ${ARG[@]}; do
-d|--directory)
OPT_EMPTY_DIR=1; debug "$LINENO: empty dir : $arg"
;;
-p|--permanently)
# permanently delete files
rm ${ARG[@]/$arg} ${FILE_NAME[*]}
debug "$LINENO: permanently: rm ${ARG[@]/$arg} ${FILE_NAME[*]}"
do_exit $LINENO 0
#rm $@ && do_exit $LINENO 0
;;

*)
invalid_option $arg
Expand Down