diff options
author | Daniel Friesel <derf@derf.homelinux.org> | 2008-06-14 12:01:45 +0200 |
---|---|---|
committer | Daniel Friesel <derf@derf.homelinux.org> | 2008-06-14 12:01:45 +0200 |
commit | ad3a39e7874daabb4056d14fffd492657c32948e (patch) | |
tree | f69fb0809dabceab95d687e06c621c4827eacf4c | |
parent | 6cedd14690f59db2157fcea9508472d19b2dd381 (diff) |
Added bin/removelinks
-rwxr-xr-x | bin/removelinks | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/bin/removelinks b/bin/removelinks new file mode 100755 index 0000000..c5e80c1 --- /dev/null +++ b/bin/removelinks @@ -0,0 +1,23 @@ +#!/usr/bin/env perl +use strict; +use warnings; + +my $i; +my $package = shift or die('not enough arguments'); +my $verbose = 1; +my $home = $ENV{HOME} || '/home/derf'; +my @binaries; + +opendir(BIN, "$home/bin"); +@binaries = readdir(BIN); +closedir(BIN); + +foreach(@binaries) { + next if $_ eq '.'; + next if $_ eq '..'; + next unless (-l); + if ((split(/\//, readlink))[2] eq $package) { + unlink("$home/bin/$_"); + print "Removed $_\n" if $verbose; + } +} |