Sponsored Content
Full Discussion: rm non-permanent delete
Top Forums UNIX for Advanced & Expert Users rm non-permanent delete Post 302481056 by tetsujin on Thursday 16th of December 2010 01:46:51 PM
Old 12-16-2010
Better yet, don't change the meaning of "rm" at all... "rm" should do what "rm" does: remove files from the directory tree structure. If you want a user-friendly "trash" command you should call it something else. Benefits:

  • You won't try to delete something and wind up merely trashing it instead
  • You won't try to trash something and wind up permanently deleting it instead (if PATH is changed to not include your script, etc.)
  • No risk of breaking existing scripts, etc. that use rm to mean what it's supposed to mean (and possibly expect the rm command to provide various options that your script doesn't...)
  • running "rm" will actually recover usable disk space, as it should.
  • "rm" remains a relatively fast operation (since you're just unlinking data, rather than possibly moving it from one filesystem to another.)
I mentioned various "rm" options your script doesn't handle: basically, that would be "--recursive" (-r) and "--force" (-f). You could handle these in the "trash" script but things quickly get more complicated. (You can "force" move, but to move recursively across filesystems you have to copy recursively and then remove the source... And then you have to worry about whether you're correctly handling cases where the copy succeeded but the remove failed for one or more files...)

IIRC the trash system on Mac OS X avoids the cross-filesystem issue by creating a trash bin on each filesystem, so that would be another possibility. But it seems to me that to do all this right is not entirely a trivial problem.
 

10 More Discussions You Might Find Interesting

1. IP Networking

Permanent ip routing

I am trying to add a permanent route on my server, but whenever i reboot it dissapears. Please does anyone know the correct command to use. route add XXX.XXX.XXX.XXX DDD.DDD.DDD.DDD the above is what i have done. ednut:) using IRIX SGI software. (2 Replies)
Discussion started by: Ednut
2 Replies

2. Shell Programming and Scripting

How do I set permanent setenv !!!

Hello, I just want to know ow I can set permanent pathes or whatever using setenv command. I'm using c shell . regards, me (1 Reply)
Discussion started by: geoquest
1 Replies

3. Solaris

permanent route

How do I make a route permanent, other than default route on a Solaris server? (1 Reply)
Discussion started by: jontom
1 Replies

4. UNIX for Dummies Questions & Answers

Permanent Alias

On AIX 5.2 as root, installed Seamonkey and have to type #/seakey/seamonkey/seamonkey to get it to run, which it does okay. To set up a permanent alias, I did the following (1) In a text editor alias seamk='/seakey/seamonkey/seamonkey' and saved it to /home/alias_file (2) In a text editor... (7 Replies)
Discussion started by: farl
7 Replies

5. Solaris

Permanent changes to PATH

Hi guys, I'm running Solars 8 on a V100 server at home for testing. If I switch user to root and do: # echo $PATH This is the output: /usr/sbin:/usr/bin I'm using rsync over ssh and need to add /usr/local/bin and /user/local/sbin. I do this by running the line: #... (3 Replies)
Discussion started by: Stin
3 Replies

6. UNIX for Dummies Questions & Answers

Making an alias permanent

Hi mates, I want to make an alias permanent for a KShell, does someone knows how to do that? Thanks! (4 Replies)
Discussion started by: agasamapetilon
4 Replies

7. UNIX for Dummies Questions & Answers

permanent change in file

Hi! i want to replace ; by ok in a file as below test1(filename) containt:- Hi i am kaushlesh; i am new to Unix. i want permanent change in the file like below:- Hi i am kaushlesh ok i am new to unix How i will complite this..? (2 Replies)
Discussion started by: kaushelsh168
2 Replies

8. UNIX for Dummies Questions & Answers

Inode: is it both unique and 'permanent'?

I try to understand the meaning of an inode. I wonder whether an inode is unique (I'm pretty sure it is) and whether it remains the same inode regardless of whatever happens to the file, dir or whatever? I read somewhere that an inode stores info about the file, size... so changing the... (4 Replies)
Discussion started by: dakke
4 Replies

9. UNIX for Dummies Questions & Answers

Permanent Dynamic “View”

Is there a way to make a permanent pseudo-file, whose contents may dynamically change? I'm thinking of something like an SQL view here. I've been trying to do this with pipes, but I haven't been able to crack it. For example, I have two files, “half1” and “half2”, which are subject to change... (3 Replies)
Discussion started by: devoll
3 Replies

10. Solaris

how to make IP address permanent.

Greetings, I am using solaris10 x86 OS. I configured IP address using the command. >ifconfig e1000g0 plumb >ifconfig e1000g0 200.200.0.1 up How to make this configured IP as permanent.. to solaris os. (2 Replies)
Discussion started by: bhargav90
2 Replies
TRASH(1)						      General Commands Manual							  TRASH(1)

NAME
trash - Command line trash utility. SYNOPSIS
trash [arguments] ... DESCRIPTION
Trash-cli package provides a command line interface trashcan utility compliant with the FreeDesktop.org Trash Specification. It remembers the name, original path, deletion date, and permissions of each trashed file. ARGUMENTS
Names of files or directory to move in the trashcan. EXAMPLES
$ cd /home/andrea/ $ touch foo bar $ trash foo bar BUGS
Report bugs to http://code.google.com/p/trash-cli/issues AUTHORS
Trash was written by Andrea Francia <andreafrancia@users.sourceforge.net> and Einar Orn Olason <eoo@hi.is>. This manual page was written by Steve Stalcup <vorian@ubuntu.com>. Changes made by Massimo Cavalleri <submax@tiscalinet.it>. SEE ALSO
trash-list(1), trash-restore(1), trash-empty(1), and the FreeDesktop.org Trash Specification at http://www.ramendik.ru/docs/trashspec.html. Both are released under the GNU General Public License, version 2 or later. TRASH(1)
All times are GMT -4. The time now is 09:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy