`lns . subdir' was trying to create a link called `subdir/.',
[sgt/utils] / lns / lns
diff --git a/lns/lns b/lns/lns
index d44dc8c..db35f9a 100755 (executable)
--- a/lns/lns
+++ b/lns/lns
@@ -107,6 +107,11 @@ $target =~ s/// if $target =~ /\/$/;    # strip trailing slash if present
 
 if ($multiple) {
   foreach $source (@ARGV) {
+    # We must path-normalise $source _before_ looking for the final
+    # filename component, to deal with the case of `lns . subdir'
+    # in which we want the link to be called subdir/<dirname> rather
+    # than subdir/. .
+    $source = &normalise($source);
     $source =~ /^(.*\/)?([^\/]*)$/;     # find final file name component
     &makelink($source, "$target/$2");   # actually make a link
   }