Renamed to trash
to bin
This commit is contained in:
parent
033bb97761
commit
3f06a798b5
8
Makefile
8
Makefile
@ -14,9 +14,9 @@ install:
|
|||||||
fi; \
|
fi; \
|
||||||
[ ! "$$prefix" ] && prefix="/usr/local"; \
|
[ ! "$$prefix" ] && prefix="/usr/local"; \
|
||||||
mkdir -pv -m 755 "$$prefix/share/man/man1" "$$prefix/bin" \
|
mkdir -pv -m 755 "$$prefix/share/man/man1" "$$prefix/bin" \
|
||||||
&& cp -v trash.1 "$$prefix/share/man/man1/" \
|
&& cp -v bin.1 "$$prefix/share/man/man1/" \
|
||||||
&& rm -f "$$prefix/bin/trash" \
|
&& rm -f "$$prefix/bin/bin" \
|
||||||
&& cp -v trash "$$prefix/bin/"
|
&& cp -v bin "$$prefix/bin/"
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
@prefix="$(PREFIX)"; \
|
@prefix="$(PREFIX)"; \
|
||||||
@ -26,6 +26,6 @@ uninstall:
|
|||||||
fi; \
|
fi; \
|
||||||
[ ! "$$prefix" ] && prefix="/usr/local"; \
|
[ ! "$$prefix" ] && prefix="/usr/local"; \
|
||||||
echo "Deleting..."; \
|
echo "Deleting..."; \
|
||||||
rm -rvf "$$prefix/bin/trash" "$$prefix/share/man/man1/trash.1"
|
rm -rvf "$$prefix/bin/bin" "$$prefix/share/man/man1/bin.1"
|
||||||
|
|
||||||
.PHONY: all, test, install, uninstall
|
.PHONY: all, test, install, uninstall
|
||||||
|
22
README.md
22
README.md
@ -1,31 +1,31 @@
|
|||||||
# trashsh - Console trash management
|
# bin - Console trash bin management
|
||||||
|
|
||||||
`trashsh` is a POSIX shell implementation of the Freedesktop.org trashcan
|
`bin` is a POSIX shell implementation of the Freedesktop.org trashcan
|
||||||
specification. It lets you run `trash <file>` to move a file to the trash
|
specification. It lets you run `bin <file>` to move a file to the trash bin
|
||||||
instead of just `rm <file>`, which permanently deletes it immediately. Later,
|
instead of just `rm <file>`, which permanently deletes it immediately. Later,
|
||||||
the file can be recovered with `trash -u <file>` or permanently erased with
|
the file can be recovered with `bin -u <file>` or permanently erased with
|
||||||
`trash -e <file>`. More details are in the Usage section. This is based off of
|
`bin -e <file>`. More details are in the Usage section. This is based off of
|
||||||
[bashtrash](https://github.com/robrwo/bashtrash), but with a few more features
|
[bashtrash](https://github.com/robrwo/bashtrash), but with a few more features
|
||||||
and a little bit cleaned up and tweaked to be fully POSIX-compliant, rather
|
and a little bit cleaned up and tweaked to be fully POSIX-compliant, rather
|
||||||
than relying on bashisms.
|
than relying on bashisms.
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
`trashsh` requires the following utilities in addition to the standard tools
|
`bin` requires the following utilities in addition to the standard tools
|
||||||
(`mv`, `rm`, etc.): `awk`, `basename`, `date`, `df`, `du`, `dirname`, `find`,
|
(`mv`, `rm`, etc.): `awk`, `basename`, `date`, `df`, `du`, `dirname`, `find`,
|
||||||
`mktemp`, `perl` (for URL encoding filenames), `readlink`, `sed`, `stty`,
|
`mktemp`, `perl` (for URL encoding filenames), `readlink`, `sed`, `stty`,
|
||||||
`tput`.
|
`tput`.
|
||||||
|
|
||||||
Optionally, if you install my other tools `ask` and `arg`, you'll get slightly
|
Optionally, if you install my other tools `ask` and `arg`, you'll get slightly
|
||||||
nicer behavior, although `trash` should work perfectly fine without them.
|
nicer behavior, although `bin` should work perfectly fine without them.
|
||||||
(ask)[https://bitbucket.org/spilt/ask] will get you slightly cleaner
|
(ask)[https://bitbucket.org/spilt/ask] will get you slightly cleaner
|
||||||
confirmation prompts, and (arg)[https://bitbucket.org/spilt/arg] will get more
|
confirmation prompts, and (arg)[https://bitbucket.org/spilt/arg] will get more
|
||||||
robust command line flag parsing (without `arg`, you must use `trash -f -v -E`
|
robust command line flag parsing (without `arg`, you must use `bin -f -v -E`
|
||||||
instead of `trash -fvE`).
|
instead of `bin -fvE`).
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Basic usage: `trash [OPTIONS]... FILES...`
|
Basic usage: `bin [OPTIONS]... FILES...`
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ Options:
|
|||||||
* `-l`, `--list` List files in trash folder(s) (default: ~)
|
* `-l`, `--list` List files in trash folder(s) (default: ~)
|
||||||
* `--` Any arguments after `--` will be treated as filenames
|
* `--` Any arguments after `--` will be treated as filenames
|
||||||
|
|
||||||
See `man trash` for full documentation.
|
See `man bin` for full documentation.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# shtrash - a pure POSIX shell script implementation of the
|
# bin - a pure POSIX shell script implementation of the
|
||||||
# FreeDesktop.org Trash Specification.
|
# FreeDesktop.org Trash Specification.
|
||||||
|
|
||||||
# Copyright (c) 2020, Bruce Hill <bruce@bruce-hill.com>
|
# Copyright (c) 2020, Bruce Hill <bruce@bruce-hill.com>
|
@ -1,10 +1,10 @@
|
|||||||
.\" Manpage for trash.
|
.\" Manpage for bin.
|
||||||
.\" Contact bruce@bruce-hill.com to correct errors or typos.
|
.\" Contact bruce@bruce-hill.com to correct errors or typos.
|
||||||
.TH man 8 "6 April 2020" "0.5" "trash manual page"
|
.TH man 8 "6 April 2020" "0.5" "bin manual page"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
trash \- A shell program for FreeDesktop.org-compliant trash management.
|
bin \- A shell program for FreeDesktop.org-compliant trash bin management.
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B trash
|
.B bin
|
||||||
[\fI-h\fR|\fI--help\fR]
|
[\fI-h\fR|\fI--help\fR]
|
||||||
[\fI-V\fR|\fI--version\fR]
|
[\fI-V\fR|\fI--version\fR]
|
||||||
[\fI-v\fR|\fI--verbose\fR]
|
[\fI-v\fR|\fI--verbose\fR]
|
||||||
@ -23,7 +23,7 @@ trash \- A shell program for FreeDesktop.org-compliant trash management.
|
|||||||
[[\fI--\fR] \fIfiles...\fR]
|
[[\fI--\fR] \fIfiles...\fR]
|
||||||
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
\fBtrash\fR is a small shell program that helps you send files to a trash
|
\fBbin\fR is a small shell program that helps you send files to a trash bin
|
||||||
directory (specified by the FreeDesktop.org Trash Specification), restore
|
directory (specified by the FreeDesktop.org Trash Specification), restore
|
||||||
files from there, and empty the trash directory.
|
files from there, and empty the trash directory.
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
@ -33,7 +33,7 @@ Print the command line usage and exit.
|
|||||||
|
|
||||||
.B \-V
|
.B \-V
|
||||||
.B \--version
|
.B \--version
|
||||||
Print \fBtrash\fR's version and exit.
|
Print \fBbin\fR's version and exit.
|
||||||
|
|
||||||
.B \-v
|
.B \-v
|
||||||
.B \--verbose
|
.B \--verbose
|
||||||
@ -82,33 +82,33 @@ If none of \fB-u\fR, \fB-e\fR, \fB-E\fR, \fB-l\fR are specified, then delete
|
|||||||
the given files. Otherwise, apply the appropriate action to them.
|
the given files. Otherwise, apply the appropriate action to them.
|
||||||
|
|
||||||
.SH NOTE ON DELETION TIMES
|
.SH NOTE ON DELETION TIMES
|
||||||
\fBtrash\fR only records the deltion time with 1-second precision, so if
|
\fBbin\fR only records the deltion time with 1-second precision, so if
|
||||||
multiple files were deleted in the same second, the behavior is undefined.
|
multiple files were deleted in the same second, the behavior is undefined.
|
||||||
|
|
||||||
.SH EXAMPLES
|
.SH EXAMPLES
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
trash foo.txt baz.txt
|
bin foo.txt baz.txt
|
||||||
Send \fIfoo.txt\fR and \fIbaz.txt\fR to the trash.
|
Send \fIfoo.txt\fR and \fIbaz.txt\fR to the trash bin.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
trash foo.txt && trash -u foo.txt
|
bin foo.txt && bin -u foo.txt
|
||||||
Trash a file and then untrash it.
|
Trash a file and then untrash it.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
trash -E
|
bin -E
|
||||||
Empty the trash.
|
Empty the trash.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
trash -E /mnt
|
bin -E /mnt
|
||||||
Empty the trash on the filesystem mounted at /mnt
|
Empty the trash on the filesystem mounted at /mnt
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
trash -E $(awk '{print $2}' /proc/mounts)
|
bin -E $(awk '{print $2}' /proc/mounts)
|
||||||
Empty all trash directories on all filesystems on the system.
|
Empty all trash directories on all filesystems on the system.
|
||||||
|
|
||||||
.SH AUTHOR
|
.SH AUTHOR
|
Loading…
Reference in New Issue
Block a user