From 9d63af994dcdeabc463fcf3b841c931ce4cb80b6 Mon Sep 17 00:00:00 2001 From: simon Date: Thu, 13 Sep 2007 13:00:37 +0000 Subject: [PATCH] `lns . subdir' was trying to create a link called `subdir/.', invariably unsuccessfully. The more useful behaviour, and also more intuitive IMO, is to have it create `subdir/dirname' where `dirname' is the name of the last path component of your cwd. git-svn-id: svn://svn.tartarus.org/sgt/utils@7720 cda61777-01e9-0310-a592-d414129be87e --- lns/lns | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lns/lns b/lns/lns index d44dc8c..db35f9a 100755 --- 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/ rather + # than subdir/. . + $source = &normalise($source); $source =~ /^(.*\/)?([^\/]*)$/; # find final file name component &makelink($source, "$target/$2"); # actually make a link } -- 2.11.0