Re: Going nuts/crazy with ln creating a symbolic link

From: Dave Carrigan (dave_at_rudedog.org)
Date: 05/26/04


Date: Wed, 26 May 2004 09:37:28 -0700

Fritz Bayer wrote:

> root@debian:/# ln -s /linktesting /tmp/burning/`date +%Y-%m-%d`

You now have a link

  /tmp/burning/2004-05-26 -> /linktesting

> root@debian:/# ln -s /linktesting /tmp/burning/`date +%Y-%m-%d`

Now, /tmp/burning/2004-05-26 exists, and is (points to) a directory, so ln
assumes you want to create a symlink inside that directory. In other words,
it behaves as if you had done

 ln -s /linktesting /tmp/burning/`date +%Y-%m-%d`/linktesting

So, now you have a link

  /tmp/burning/2004-05-26/linktesting -> /linktesting

> root@debian:/# ln -s /linktesting /tmp/burning/`date +%Y-%m-%d`

The behavior of this command is exactly the same as the previous command,
except this time the link already exists, so you get an error message.

-- 
Dave Carrigan
Seattle, WA, USA
dave@rudedog.org | http://www.rudedog.org/ | ICQ:161669680
UNIX-Apache-Perl-Linux-Firewalls-LDAP-C-C++-DNS-PalmOS-PostgreSQL-MySQL
Dave is currently listening to Jane Siberry - Follow Me (No Borders Here)


Relevant Pages

  • coreutils-8.0 released [beta]
    ... or run this command from a git-cloned coreutils directory: ... run a command like this: ... for the inode number and allocated size of a dereferenced dangling symlink. ... was quadratic in the depth of the hierarchy, ...
    (gnu.announce)
  • Re: Is is possible to edit a symbolic link on the command line?
    ... > the command line editor to make the correction. ... You'll find most things much easier with bash than tcsh. ... > directory in vim and edit the symlink. ...
    (comp.os.linux.misc)
  • Re: Disk Resync Problem
    ... > ln -s first.c sym ... In your last command, first.c is created by ... writing to the symlink which points to first.c. ...
    (comp.unix.internals)
  • Re: Disk Cleanup
    ... "Doug Laidlaw" quoted and wrote in message ... > made it a subdirectory of /opt then created a symlink pointing to it. ... it's "/dev/hda5" then the command above answers the question you pose IIUC, ... but all ambiguity can be solved if you ...
    (comp.os.linux.misc)
  • Re: Time discrepancy II
    ... use this command - ... so the operating system can pick up the change. ... a symlink name localtime which is linked to the appropriate ...
    (comp.sys.mac.system)