findstring.sh
来自「Shall高级编程」· Shell 代码 · 共 23 行
SH
23 行
#!/bin/bash# findstring.sh:# Find a particular string in the binaries in a specified directory.directory=/usr/bin/fstring="Free Software Foundation" # See which files come from the FSF.for file in $( find $directory -type f -name '*' | sort )do strings -f $file | grep "$fstring" | sed -e "s%$directory%%" # In the "sed" expression, #+ it is necessary to substitute for the normal "/" delimiter #+ because "/" happens to be one of the characters filtered out. # Failure to do so gives an error message (try it).done exit 0# Exercise (easy):# ---------------# Convert this script to take command-line parameters#+ for $directory and $fstring.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?