From: Sidney Lambe on 10 Apr 2010 21:26 On comp.os.linux.misc, Harald Meyer <meyersharald(a)googlemail.com> wrote: > Sidney Lambe wrote: > >>> cp /home/dan/.local/share/Trash/files/gfortran/doc/gfortran.pdf ~/ > >> Why bother leaving a copy in .../Trash/....? > > Just in case he deletes it with rm next time. Oh. I figured that's what he did this time and rm was a function that sent it to trash instead of actually deleting it. I've seen that a lot on various Linuxes. rm () { mv "$@" /tmp/trashbin/ ; } A cron job running a find script cleans out files that have been in the trash dir longer than N days... All things reconsidered, I have to admit that yours is probably the better idea here. Sid
From: Harald Meyer on 10 Apr 2010 21:29 Chris F.A. Johnson wrote: > On 2010-04-11, unruh wrote: >> function rm () { cp $* /tmp; /bin/rm $* ;} ^ > rm() { cp "$@" /tmp; /bin/rm "$@"; } ^ May I suggest to use "&&" instead of ";" ?
From: Sidney Lambe on 10 Apr 2010 21:32 On comp.os.linux.misc, Chris F.A. Johnson <cfajohnson(a)gmail.com> wrote: > On 2010-04-11, unruh wrote: >> On 2010-04-11, Deinonychus Antirrhopus <velociraptorinae.deinonychus(a)googlemail.com> wrote: >>> On Sun, 11 Apr 2010 02:29:46 +0200, Sidney Lambe wrote: >>> >>>> (Must be a KDE/Gnome user.) >>> >>> Otherwise he would have much more trouble recovering his file. >>> >> >> Well, I have in .bashrc >> function rm () { cp $* /tmp; /bin/rm $* ;} > > ...which will fail if any filenames contain whitespace. Filenames with whitespaces is a Windows idiocy. I don't allow them on my box. I don't know any Linux runners who do. (Another technocrat trying to turn Linux into Windows.) [delete] Sid
From: Chris F.A. Johnson on 10 Apr 2010 21:37 On 2010-04-11, Harald Meyer wrote: > Chris F.A. Johnson wrote: >> On 2010-04-11, unruh wrote: > >>> function rm () { cp $* /tmp; /bin/rm $* ;} > ^ >> rm() { cp "$@" /tmp; /bin/rm "$@"; } > ^ > May I suggest to use "&&" instead of ";" ? Good point! -- Chris F.A. Johnson, <http://cfajohnson.com> Author: Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress) Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
From: Harald Meyer on 10 Apr 2010 21:45
Sidney Lambe wrote: > Filenames with whitespaces is a Windows idiocy. Yes. But sometimes one has to exchange files with Windows users, or a Linux box is a fileserver for Windows clients, so every script should be able to handle filenames with spaces. > (Another technocrat trying to turn Linux into Windows.) No, just somebody who takes care. |