Debian Codegraph @

findstring.sh

raw symbols SCIP
1 #!/bin/bash
2 # findstring.sh:
3 # Find a particular string in the binaries in a specified directory.
4
5 directory=/usr/bin/
6 fstring="Free Software Foundation" # See which files come from the FSF.
7
8 for file in $( find $directory -type f -name '*' | sort )
9 do
10 strings -f $file | grep "$fstring" | sed -e "s%$directory%%"
11 # In the "sed" expression,
12 #+ it is necessary to substitute for the normal "/" delimiter
13 #+ because "/" happens to be one of the characters filtered out.
14 # Failure to do so gives an error message. (Try it.)
15 done
16
17 exit $?
18
19 # Exercise (easy):
20 # ---------------
21 # Convert this script to take command-line parameters
22 #+ for $directory and $fstring.