20 lines
322 B
Bash
Executable File
20 lines
322 B
Bash
Executable File
#!/bin/bash
|
|
|
|
v_flag=""
|
|
flag=""
|
|
|
|
while getopts ':v:' flag; do
|
|
case "${flag}" in
|
|
v) v_flag="${OPTARG}";;
|
|
*) echo "invalid flag"
|
|
exit 1 ;;
|
|
esac
|
|
done
|
|
|
|
if [[ "$v_flag" == "" ]]
|
|
then
|
|
find . -not -type d | xargs grep $@ 2>/dev/null
|
|
else
|
|
find . -not -type d | grep -v "$v_flag" | xargs grep $@ 2>/dev/null
|
|
fi
|