summaryrefslogtreecommitdiff
path: root/bin/removelinks
diff options
context:
space:
mode:
Diffstat (limited to 'bin/removelinks')
-rwxr-xr-xbin/removelinks23
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;
+ }
+}