मुझे पूरी तरह से समझ में नहीं आ रहा है कि आप क्या पूछ रहे हैं। अगर मुझे कोई बेहतर पता नहीं था, तो मुझे लगता है कि आप पूछ रहे थे कि क्या फ़ाइल से निपटने के बीच में इसका पता लगाने का कोई तरीका था। मुझे विश्वास नहीं होता कि यह संभव है।
एकमात्र विधि जिसकी मैं गर्भधारण कर सकता हूं वह एक ऐसा स्थान है जहां आप विशेष रूप से निर्देशिका पेड़ में एक विशेष शाखा के माध्यम से देखना शुरू करते हैं।
उदाहरण
$ tree
.
`-- a
`-- b
|-- c
| `-- d
| `-- e -> ../../../../a/b
`-- e -> e
5 directories, 1 file
findआदेश इस पाश का पता लगाने जाएगा, लेकिन नहीं वास्तव में आप इसके बारे में एक पूरी बहुत कुछ बता सकते हैं।
$ find -L . -mindepth 15
find: File system loop detected; `./a/b/c/d/e' is part of the same file system loop as `./a/b'.
find: `./a/b/e': Too many levels of symbolic links
मैंने मनमाने ढंग से 15 स्तर उठाए ताकि किसी भी आउटपुट को प्रदर्शित किया जा सके find। हालाँकि आप उस स्विच को बंद कर सकते हैं ( -mindepth) यदि आप डायरेक्टरी ट्री के प्रदर्शित होने की परवाह नहीं करते हैं। findआदेश अभी भी पाश और बंद हो जाता है का पता लगाता है:
$ find -L .
.
./a
./a/b
./a/b/c
./a/b/c/d
find: File system loop detected; `./a/b/c/d/e' is part of the same file system loop as `./a/b'.
find: `./a/b/e': Too many levels of symbolic links
संयोग से, यदि आप डिफॉल्ट को ओवरराइड करना चाहते हैं MAXSYMLINKSजो स्पष्ट रूप से 40 लिनक्स पर है (कर्नेल के नए 3.x संस्करण) तो आप इस U & L Q & A शीर्षक को देख सकते हैं: आप MAXSYMLINKS कैसे बढ़ा सकते हैं ।
सिमिलिंक कमांड का उपयोग करना
एक उपकरण है जिसे एफ़टीपी साइट अनुरक्षक कह सकते हैं symlinks जो टूल लंबी या लटकते पेड़ों के साथ मुद्दों को उजागर करने में मदद करेगा जो प्रतीकात्मक लिंक के कारण थे।
कुछ मामलों में symlinksटूल का उपयोग अपमानजनक लिंक को हटाने के लिए भी किया जा सकता है।
उदाहरण
$ symlinks -srv a
lengthy: /home/saml/tst/99159/a/b/c/d/e -> ../../../../a/b
dangling: /home/saml/tst/99159/a/b/e -> e
शानदार पुस्तकालय
Glibc लाइब्रेरी इसके चारों ओर कुछ C फंक्शंस पेश करती है, लेकिन मैं पूरी तरह से उनकी भूमिका या वास्तव में उनका उपयोग कैसे करना है, यह नहीं जानता। इसलिए मैं केवल उन्हें आपको इंगित कर सकता हूं।
मैन पेज, man symlinkफंक्शन नामक फंक्शन की परिभाषा को दर्शाता है symlink()। विवरण इस प्रकार है:
symlink () newpath नाम का एक प्रतीकात्मक लिंक बनाता है जिसमें स्ट्रिंग ओल्डपथ होता है।
एक त्रुटि बताती है कि यह फ़ंक्शन लौटाता है:
ELOOP नएपथ को हल करने में कई प्रतीकात्मक लिंक सामने आए।
मैं आपको मैन पेज पर भी निर्देशित करूंगा, man path_resolutionजिसमें चर्चा की गई है कि कैसे यूनिक्स डिस्क पर आइटम के लिए पथ निर्धारित करता है। विशेष रूप से यह पैराग्राफ।
If the component is found and is a symbolic link (symlink), we first
resolve this symbolic link (with the current lookup directory as starting
lookup directory). Upon error, that error is returned. If the result is
not a directory, an ENOTDIR error is returned. If the resolution of the
symlink is successful and returns a directory, we set the current lookup
directory to that directory, and go to the next component. Note that the
resolution process here involves recursion. In order to protect the
kernel against stack overflow, and also to protect against denial of
service, there are limits on the maximum recursion depth, and on the maximum
number of symbolic links followed. An ELOOP error is returned when the
maximum is exceeded ("Too many levels of symbolic links").
readlink ...उपरोक्त स्थितियों के बारे में कमांड लाइन टूल क्या कहता है?