用来查找文件里的内容的脚本【原创】

一个Linux下的脚本,用来查找文件里的内容,输入相应的字符串就可以,当然功能并不是那么复杂的查找,仅仅是简单查找

#!/bin/bash 
 
FIND_PATH = "/home/sky/my_test/"
  
read -p "Input key word: " SOURCE  
makefilepath=$(find $FIND_PATH )  
for way in $makefilepath  
do  
    grep -n --color=auto $SOURCE $way  
    #echo $?  
    #if [ "$?" == "0"  ]; then  
    if [ $? -eq 0  ]; then  
        echo $way | awk 'BEGIN {FS="/"}{printf $NF "
"}'  
        echo "-------------------"  
    fi  
done
原文地址:https://www.cnblogs.com/sky-heaven/p/8338102.html