Path: utzoo!attcan!uunet!rbj From: rbj@uunet.UU.NET (Root Boy Jim) Newsgroups: comp.unix.internals Subject: Re: How do you find the symbolic links to files. Message-ID: <114209@uunet.UU.NET> Date: 11 Dec 90 00:46:52 GMT References: <25110@adm.brl.mil> Organization: UUNET Communications Services, Falls Church, VA Lines: 29 In article bzs@world.std.com (Barry Shein) writes: >From: mchinni@pica.army.mil (Michael J. Chinni, SMCAR-CCS-E) >>If so, how would you find all symbolic links to the file ? The hard way. By looking thru the entire filesystem, examining every file, and determining whether it points to the target. >In general, it's very difficult. Consider that valid symlinks can >point across NFS mounts. Hmmm, I hadn't thought of that. I suppose it all depends on what stat returns for st_dev and st_ino. > % find /mount-point -type l -a -exec testinode '{}' #inum ';' Gee, Barry, using -exec is so passe :-) XARGS is the way to go. Your program testinode should accept multiple arguments. The first arg is special and contains tha name of the target file. If the st_dev and st_ino match, print the sucker. > -Barry Shein > >Software Tool & Die | {xylogics,uunet}!world!bzs | bzs@world.std.com >Purveyors to the Trade | Voice: 617-739-0202 | Login: 617-739-WRLD -- Root Boy Jim Cottrell Close the gap of the dark year in between