![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| awk script to search an html file and output links | kyris | Shell Programming and Scripting | 8 | 05-11-2008 05:25 AM |
| Listing all links in a file system | ruger14 | UNIX for Dummies Questions & Answers | 3 | 02-21-2007 09:39 AM |
| How to get all the links of a file? | Chanakya.m | Shell Programming and Scripting | 3 | 08-22-2006 03:09 AM |
| Symbolic Links for a File | b_u_n_1234 | UNIX for Dummies Questions & Answers | 4 | 03-06-2002 12:58 PM |
| Finding symbolic links | mehtad | UNIX for Dummies Questions & Answers | 2 | 11-15-2001 06:26 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
finding links to a file
I am writing a shell script that needs to files that are links to on specific shell script.
e.g. /usr/bin/a.sh /home/mydir/a.sh --> /usr/bin/a.sh /home/yourdir/a.sh --> /usr/bin/a.sh /home/hisdir/a.sh --> /usr/bin/a.sh /home/herdir/a.sh --> /usr/bin/a.sh I know I can set myself at the /home and "find" the links, but my question is more to the guru types. Is there a simple command that I can use on /usr/bin/a.sh to get the list of all the files that have links to it? It might give output like: # lnk2file /usr/bin/a.sh /home/mydir/a.sh /home/yourdir/a.sh /home/hisdir/a.sh /home/herdir/a.sh # Just want to know if there is a better way to skin this cat. TIA hagar |
|
||||
|
If you think about how links are implemented, I would say the generic answer is no. Hard links are just directory entries in different places which link to the same inode number; there is no link in the other direction. Similarly, symbolic links are typically just a text snippet which says where to link to, and a special flag in the directory entry tells the kernel to read the file and redirect to the file pointed to by the text snippet. Again, there is no link in the other direction.
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|