Hi,
The command output:
Code:
root@laptop:/home/huangyingw/myproject/git/java/algorithm# fw . public
-iname *.java -o -iname *.h -o -iname *.sh
find . \( -iname *.java -o -iname *.h -o -iname *.sh \) -exec fgrep -wnH public {} ;
find: invalid expression; you have used a binary operator '-o' with nothing before it.
root@laptop:/home/huangyingw/myproject/git/java/algorithm#
file fw.sh
Code:
huangyingw@laptop:~/bashrc$ cat fw.sh 
#!/bin/bash
FILE_POSTFIX=$HOME/bashrc/postfix.bak
find_params=(); or="";
while read suf
do
  find_params+=( $or "-iname" "*.$suf" )
  or="-o"
done < "$FILE_POSTFIX"
echo "${find_params[@]}"
echo find "$1" "\( ${find_params[@]} \)" -exec fgrep -wnH  "$2" {} \;
find "$1" "\( ${find_params[@]} \)" -exec fgrep -wnH  "$2" {} \;
file postfix.bak:
Code:
huangyingw@laptop:~/bashrc$ cat postfix.bak 
java
h
sh
huangyingw@laptop:~/bashrc$