In figuring out how to search $LD_LIBRARY_PATH for (hopefully not multiply) installed versions of libraries, I found that $LD_LIBRARY_PATH, being colon-delimited, was not suitable argument for the unix `find` command.
Thus, an 'on-the-fly' edit to replace the colons with spaces is needed, consing up a suitable arg to find.
I had never used the string substitution modifer to bash's parameter expansion. Now I do.
For example:
>find ${LD_LIBRARY_PATH//:/ } -maxdepth 1 -name libreadline.* -print
/usr/lib/libreadline.so.4.3
/usr/lib/libreadline.so
/usr/lib/libreadline.a
/usr/lib/libreadline.so.4
Which prompts me to write the following bash function:
function llpfind {
# PURPOSE: search $LD_LIBRARY_PATH
# EXAMPLE: llpfind -name libreadline.*
find ${LD_LIBRARY_PATH//:/ } -maxdepth 1 $@ -print
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment