Move under www to ease rsync
This commit is contained in:
23
www/eps/hpr2816/hpr2816_awk14_ex3.awk
Executable file
23
www/eps/hpr2816/hpr2816_awk14_ex3.awk
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/awk -f
|
||||
|
||||
# Downloadable example 3 for GNU Awk Part 14
|
||||
|
||||
{
|
||||
# Split the path up into components
|
||||
n = split($0,a,"/")
|
||||
if (n < 2) {
|
||||
print "Error in path",$0 > "/dev/stderr"
|
||||
next
|
||||
}
|
||||
|
||||
# Build the shell command so we can show it
|
||||
cmd = sprintf("[ -e %s ] && ln -s -f %s %s",$0,$0,a[n])
|
||||
print ">> " cmd
|
||||
|
||||
# Feed the command to the shell
|
||||
printf("%s\n",cmd) | "sh"
|
||||
}
|
||||
|
||||
END {
|
||||
close("sh")
|
||||
}
|
||||
Reference in New Issue
Block a user