Did You Know?

You can make a symbolic link that points to a file that does not exist. The link becomes active when the file that it points to is created.

Removing the file does not affect the symbolic link itself and you can substitute another file for it to point to. Look at this example:

   ln -s $HOME/accounts/pending current
       (make a symbolic link to a non-existent file)
   more current
   cat: accounts/pending: No such file or directory
       (this is what happens if you try to page it)
   cp ~/accounts/may ~/accounts/pending
       (now to create the file that the symbolic link points to)
   more current
   XYZ Co. Accounts for May 1993
   .....
       (and the symbolic link works)
   rm ~/accounts/pending; more current
   cat: accounts/pending: No such file or directory
       (removing the file makes the symbolic link inactive)
   cp ~/accounts/june ~/accounts/pending
   more current
   XYZ Co. Accounts for June 1993
   ...
       (creating another file that the link points to
            makes it active once again)

[Home] [Search] [Index] This site maintained by unixhelp@hardrock.org