blob: 2d8e5f654061a8200c1559ee8be18590139e6a00 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#!/usr/bin/perl
($op = shift) || die "Usage: relink perlexpr [filenames]\n";
if (!@ARGV) {
if (-t) {
@ARGV = <*>;
}
else {
@ARGV = <STDIN>;
chop(@ARGV);
}
}
for (@ARGV) {
next unless -l; # symbolic link?
$name = $_;
$_ = readlink($_);
$was = $_;
eval $op;
die $@ if $@;
if ($was ne $_) {
unlink($name);
symlink($_, $name);
}
}
|