afox123 发表于 2017-5-16 11:05:31

shell实现在头文件搜索目录中搜索指定的头文件

#!/bin/bash
# 搜索头文件的路径
if [ $# -lt 1 ]; then
echo "参数太少了!
第一个参数是头文件的名字"
exit 1
fi
dir="/usr/include:/usr/local/include:/usr/lib/gcc-lib"
header=$1
echo $dir | sed 's/:/\n/g' | while read line
do
find $line | grep -e "/"$header"$"
done
exit 0
 
页: [1]
查看完整版本: shell实现在头文件搜索目录中搜索指定的头文件