Thursday, July 20, 2006

unlink for ln to hostmyapp

ln -s ~/app_rails/typo_ver_numb/public ~/htdoc/typo

but

unlink


When using the rm or unlink command to remove a symbolic link to a directory, make sure you don’t end the target with a ‘/’ character because it will create an error. Example:

$ mkdir dirfoo
$ ln -s dirfoo lnfoo
$ rm lnfoo/
rm cannot remove directory ‘lnfoo/’ : Is a directory
$ unlink lnfoo/
unlink: cannot unlink ‘lnfoo/’: Not a directory
$ unlink lnfoo
$

Notice how one complains it “Is a directory”, but the other complains it is “Not a directory”, which I found confusing. This is a problem if you have a tendency to use tab completion a lot, because it will stick a ‘/’ at the end