Thu 2009-01-01 ( En pr )

Ever wondered where a deep symlink points to? Try tracelink.

13:59:48 ~ $ tl foo2
foo2 --> foo (relative)
foo --> bla (relative)
bla: empty
14:00:27 ~ $ tl `which tl`
/usr/local/bin/tl --> /usr/local/bin/tracelink (absolute)
/usr/local/bin/tracelink: a ruby script text executable
14:00:34 ~ $ cat `which tl`
#!/usr/bin/env ruby
link = ARGV.first
while link and not link.empty?
  target = `readlink #{link}`.chomp
  break if target.empty?
  if target[0,1] == '/'
    puts link + ' --> ' + target + ' (absolute)'
  else
    puts link + ' --> ' + target + ' (relative)'
  end
  if File.dirname(link) == '.' || target[0,1] == '/'
    link = target
  else
    link = File.join File.dirname(link), target
  end
end
puts `file #{link}` if link && !link.empty?

Say something! / Sag was!

No markup, just plain monospace text. / Kein Markup, nur Normschrift-Klartext.