I know the thread and try to fix my find with -mindepth 15
unsuccessfully
find -L $HOME -type f -name "*.tex" \
-exec fgrep -l "janne" /dev/null {} + | vim -R -
Unsuccessful attempt
find -L $HOME -type f -mindepth 15 -name "*.tex" \
-exec fgrep -l "janne" /dev/null {} + | vim -R -
find -L
about it here
Its STOUT
Vim: Reading from stdin...
find: ‘/home/masi/LOREM’: Too many levels of symbolic links
Visualization of symlinks unsuccessful which gives all files while I would like to see only symlinked directories and files in the system
tree -l
Law29's proposal
# include symlinks
find "$1" -type l -name "$2*" -print0 \
| xargs -0 grep -Hr --include "*.tex" "$2" /dev/null {} + | vim -R -
Output unsuccessful but it should not be empty
Vim: Reading from stdin...
grep: {}: No such file or directory
grep: +: No such file or directory
Characteristics of the system
masi@masi:~$ ls -ld -- "$HOME" /home/masi/LOREM
drwxr-xr-x 52 masi masi 4096 Aug 16 16:09 /home/masi
lrwxrwxrwx 1 masi masi 17 Jun 20 00:27 /home/masi/LOREM -> /home/masi/LOREM/
masi@masi:~$ type find
find is /usr/bin/find
masi@masi:~$ find --version
find (GNU findutils) 4.7.0-git
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Eric B. Decker, James Youngman, and Kevin Dalley.
Features enabled: D_TYPE O_NOFOLLOW(enabled) LEAF_OPTIMISATION FTS(FTS_CWDFD) CBO(level=2)
System: Linux Ubuntu 16.04 64 bit
For for Script at the thread: here
Find: 4.7.0
Grep: 2.25
Application of find
: haetex
here
find -L
./home/masi/LOREM
as a symlink to itself? You will get the error "Too many levels of symbolic links" from any utility that attempts to dereference this circular link.-L
then you will get the error message, "Too many levels of symbolic links". If you don't want to follow the broken symbolic link (i.e. you use-H
or nothing at all) then you won't get the error.find
won't follow infinite loops - it keeps track of the places it's already visited and won't use them a second time around. If you want to follow symlinks then you will get errors from entries like the one you've created with yourLOREM
file. The only way to avoid those is to redirect stderr away from the terminal (for example to/dev/null
). Or to change the source code forfind
and have it not print the corresponding error message.