> > IFS="" find "$dir" -name '*.so' -print | while read -r file > > do > > if ! $(echo "$file" | grep -E "*.so$"); then continue; fi > > echo "library: $file" > > > > done
Also, I forgot to point out: your "if" line is executing each of the shared libraries that you find. Every one of them matches the grep check, and since you enclosed the check in a command substitution, the output of grep (which is the pathname) is *executed* as a command. That's probably where your segfault is happening. Once you remove this completely unnecessary and incorrectly written check, the segfaults from running random shared library files as commands will stop happening.