ファイルの中身確認してから消すって事多いから、中身出力して消すか確認してくるスクリプト書いた。
— ひさいち (@hisaichi5518) 2014, 7月 7
test.rbとかtest.plとか適当に作りまくるので、それの削除とかに使う。
#!perl use 5.16.1; use strict; use warnings; use Path::Tiny; use IO::Prompt::Simple; main(@ARGV); sub main { my (@files) = @_; for my $file (@files) { next if !confirm($file); del($file); } } sub confirm { my ($file) = @_; say path($file)->slurp; my $answer = prompt 'delete this file? [y/n]'; return 1 if $answer eq "y"; return; } sub del { my ($file) = @_; say `~/bin/del $file`; }
~/bin/delは、$fileを.Trash/nnnnnn に移動させるルッビースクリプトです。