On Mon, 11 Jul 2005 10:18:18 +1200 (NZST) John Carter wrote: > On Mon, 11 Jul 2005, Steve Holdoway wrote: > > > > > On Mon, July 11, 2005 8:30 am, John Carter said: > >> The file pointed to doesn't have to exist, or may exist on a different > >> drive. The symlink itself is not a file, it is merely a tweak inside a > >> directory file. > > > > Err... a hard link is a duplicate entry to a pre-existing inode entry on > > that partition. That said, the file *must* exist before hard linking to > > it. > > Yup, I was talking about symbolic links (symlink) not hard. Destination of > hardlink must exist and exist on the same partition. Destination of > shambolic link needn't be on same partition, or same drive or even exist. > > Now that I have spotted my mistake and seen that symlinks have there own > inode number. Question for the group: > > Without writing my own code, how can I open the symlink file (not the > file it points to) with something like "od" to see whats inside it?
I think that all that is inside it is text with the path to the file it is linked to. If you look at the length of a symlink, it is always the same as the number of characters in the path+file it points to. The system knows that it is a pointer to another file because it's file type is "link". > > Fascinating, I can use the command inode-cat to do this to a conventional > file, but it freaks with a lseek error if I point it at a symlink inode. > > > John Carter Phone : (64)(3) 358 6639 > Tait Electronics Fax : (64)(3) 359 4632 > PO Box 1645 Christchurch Email : [EMAIL PROTECTED] > New Zealand > > Carter's Clarification of Murphy's Law. > > "Things only ever go right so that they may go more spectacularly wrong > later." > > From this principle, all of life and physics may be deduced. -- Nick Rout
