This seemingly useless script saves considerable time if used during
command-line-browsing through directories following symlinks.
symlinkdir displays the directory a symbolic link points to. If you're
in /home/user and there's a symbolic link MyModule.pm which
points to /home/user/projects/My/eg/MyModule.pm, you can quickly
change to the directory the original MyModule.pm file is located in
(/home/user/projects/My/eg) by typing
cds MyModule.pm
given that your bash or similar shell defined a function
function cds () { cd `symlinkdir $1`; pwd; ls; }
symlinkdir resolves symbolic links recursively, so if you have a link
dir1 pointing to dir2 pointing to dir3, it will properly
display dir2 when called on dir1/file.
If the link points to a directory instead of a file, symlinkdir
will display this directory instead of going an additional level up.
Copyright 2002 by Mike Schilli, all rights reserved.
This program is free software, you can redistribute it and/or
modify it under the same terms as Perl itself.