원형 심볼릭 링크는 어떻게 찾습니까? 있습니다 : ls -lrt

HP-UX 시스템에서 작업 중이며 원형 심볼릭 링크가 있는지 알고 싶습니다.

지금까지 나는 명령을 사용하고 있습니다 :

ls -lrt  `find ./ -follow -type l`

그러나 결과적으로 현재 디렉토리에서 ls -lrt 만 수행합니다.

시스템에서 모든 원형 심볼릭 링크를 찾으려면 어떤 명령을 사용해야합니까?



답변

GNU find의 맨 페이지에 따르면 모든 POSIX에서 찾은 파일 시스템 루프를 감지하고 이러한 경우 오류 메시지가 표시된다고합니다.

find . -follow -printf ""

GNU의 형태의 루프를 찾을 수 있었다 발견에 ./a -> ./b./b -> ./a오류를 인쇄

find: `./a': Too many levels of symbolic links
find: `./b': Too many levels of symbolic links

(이것도 작업했습니다 a->b->c->a)

마찬가지로, 형태의 루프 ./foo/x -> .../foo/a -> ./bar+ ./bar/b -> ./foo오류를 인쇄

find: File system loop detected; `./foo/a/b' is part of the same file system loop as `./foo'.
find: File system loop detected; `./bar/b/a' is part of the same file system loop as `./bar'.
find: File system loop detected; `./foo/x' is part of the same file system loop as `.'.

출력 이외의 출력으로 무언가를 수행하려면 stderr에서 stdout으로 경로 재지 정하고 오류 메시지를 구문 분석 할 수있는 스크립트로 파이프해야합니다.