From: Rudolf Polzer Date: 2002-12-08T18:05:30+09:00 Subject: Re: Thank God for backups Scripsit ille Rudolf Polzer : > Scripsit ille aut illa Gavin Sinclair : > > From: "Rudolf Polzer" > [...] > > > ..bashrc: > > > | alias rm=recycle > > > > Nice. CAn we have that in Ruby, please? :) > > My first attempt (it uses a configuration file in ~/.recycle which looks > like the following: > > mountpoints = /etc/fstab > additional characters = ������� > pathsep = : > trash of /tmp = /mnt/ramdisk/.recycled > > where the mountpoints file must look like a fstab, additional characters > are not escaped in pathnames and pathsep is used instead of / to escape > path names (if using /, they are escaped to %2F)). [...] > begin > IO.foreach($config['mountpoints']) do |line| > line.chomp!() > line.sub!(/^#.*/, ' ') > line.sub!(/\s+/, ' ') ^^^^ This has to be a gsub!. > line.sub!(/^ | $/, '') > ents = line.split(/ /) > dir = ents[1] # fstab syntax > dev = File::stat(dir).dev() > $mountpoints[dev] = dir > end > rescue > end [...] -- [mpg123d] Just playing: .../Yuko Miyamura & Kyoko Hikami - Miracle Body Ni Goyougin (maybe).mp3 The math could be slightly incorrect, but it sounds right. RFC 2795