Re: rm -rf and the trashcan
Re: rm -rf and the trashcan
- Subject: Re: rm -rf and the trashcan
- From: Jean-Daniel Dupas <email@hidden>
- Date: Tue, 21 Jul 2009 01:02:40 +0200
Le 21 juil. 09 à 00:43, Greg Shenaut a écrit : On Jul 20, 2009, at 12:00 PM, Esteban Bodigami wrote: unless the OS relies on all Unix commands and has to be translated to all possible languages (the "talking with the kernel" text interface).
2009/7/20 Jean-Daniel Dupas <email@hidden>
alias borrar 'mv ~/.Trash'
No need to rewrite an OS to get it.
Aliasing standard commands like "rm" has been part of UNIX for decades. If a certain user aliases things or defines functions in his or her own shell, shell scripts and other people's shells normally won't see them, so it will have no effect on the system as a whole. But it should be mentioned that defining a shell function to imitate the Finder's trash functionality is not just « function rm { mv $* ~/.Trash ; } », because the Finder will modify filenames to avoid overwriting the older contents of Trash. You could definitely write a shell function to mimic what Finder does, but another approach would be to use osascript in your shell function to tell Finder to do it for you.
Eventually, writing a command line tool will be faster.
int main(int argc, char **argv) { for (int idx = 1; idx < argc; idx++) FSPathMoveObjectToTrashSync(argv[idx], NULL, 0); return 0; }
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden