Differences

This shows you the differences between two versions of the page.

Link to this comparison view

shell [2019/01/17 21:25]
dblume [jq Tips]
shell [2019/10/20 17:17] (current)
dblume
Line 2: Line 2:
  
 Here's a tutorial: [[http://tldp.org/LDP/abs/html/|Advanced Bash-Scripting Guide]]. Here's a tutorial: [[http://tldp.org/LDP/abs/html/|Advanced Bash-Scripting Guide]].
 +
 ===== Quick Tips ===== ===== Quick Tips =====
  
Line 553: Line 554:
 </code> </code>
  
 +====== Protips for find ======
 +
 +[[https://stackoverflow.com/a/2962015/9181|How to use "sh -c" without {} in find's -exec]].
 +
 +Given a lib directory, I wanted to find all the actual .so files that needed libz.
 +
 +  find lib -type f -name \*.so\* -exec sh -c 'objdump -p "$1" | grep "NEEDED.*libz"' - {} \; -print
 +  
 +Note that you can pass -print (or -and -print) after a -exec argument. Also, the " - " is just a placeholder for $0 (usually the command name, in this case "sh"), we want $1 to be {}. It outputs results like:
 +
 +    NEEDED               libz.so.1
 +  lib/libprotoc.so.13.0.2
  
 ====== Additional Keywords ====== ====== Additional Keywords ======
  
 Linux, Unix, *nix Linux, Unix, *nix
shell.txt · Last modified: 2019/10/20 17:17 by dblume
 
Recent changes RSS feed Driven by DokuWiki