Skip to content

Instantly share code, notes, and snippets.

@roc26002w
Last active January 26, 2017 04:03
Show Gist options
  • Save roc26002w/109ba5e3864d4e5e9ee20c053f60a997 to your computer and use it in GitHub Desktop.
Save roc26002w/109ba5e3864d4e5e9ee20c053f60a997 to your computer and use it in GitHub Desktop.
#!/bin/bash
function gateFile(){
for file in $1
do
if [ -d "${file}" ]
then
gateFile "${file}/*"
fi
if [ -f "${file}" ]
then
grep -rnw "${file}" -e "search text"
#echo "get file and fine name is ${file}"
fi
done
}
gateFile $1
方案二 :
# 每個目錄都會進去搜尋 `productcategory` 字串
find -L . -exec grep -i productcategory {} +
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment