Hello monks!
I have a hash of links
%links. The key is the source of the link and the value is the target of the link.
I'm trying to create a script which creates those links (by using
ls -s [target] [source]).
At first I thought that it does not really matter the order of creating the links. So I did:
foreach my $link (keys(%links)) {
my $target = $links{$link};
print $fh "ln -s $target $link\n";
}
The problem is with a link that dependent on another link. So for example if I have those links:
ln -s ../python2/2.7.15 /usr/pkgs/python/2.7.5
ln -s /nfs/tools/data /usr
So in that case, since we create
/usr only after trying to create
/usr/pkgs/python/2.7.5 it will fail.
Is it possible to suggest a strategy on how to find the right order of the links?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.