Quoting
Strangely enough this works better.
This commit is contained in:
parent
9e91e3816d
commit
4dd6739c01
11
misc/gc.awk
11
misc/gc.awk
|
@ -5,26 +5,19 @@ BEGIN {
|
|||
RS = OFS = ORS = "\000"
|
||||
}
|
||||
|
||||
# courtesy freenode#awk/izabera
|
||||
function quote(str) {
|
||||
gsub(/'/, "\\'", str);
|
||||
return str
|
||||
}
|
||||
|
||||
{
|
||||
path = $0
|
||||
getline time
|
||||
|
||||
qpath = quote(path)
|
||||
r = stat(path)
|
||||
data[1] = 1
|
||||
if (stat(path, data) == -1) {
|
||||
if ("locate -b -l 1 -e '/" qpath "$'" | getline npath > 0) {
|
||||
if ("locate -b -l 1 -e \"/" path "$\"" | getline npath > 0) {
|
||||
npath = ""
|
||||
}
|
||||
print path npath "\000";
|
||||
if (!npath) {
|
||||
print "Removing " qpath "\n" > "/dev/stderr"
|
||||
print "Removing " path "\n" > "/dev/stderr"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue