Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- ALL=false
- PATH=./
- usage()
- {
- echo "Usage: $0 WORD [-a] [ -p PATH ]"
- exit 2
- }
- if [ $# = 0 ]
- then
- usage
- fi
- WORD=$1
- shift
- while getopts 'ap:' OPTION
- do
- case ${OPTION} in
- a)
- ALL=true ;;
- p)
- PATH=$OPTARG ;;
- esac
- done
- if [ "$ALL" = true ]
- then
- RESULT=$(/bin/grep -lR ${WORD} $PATH)
- else
- RESULT=$(/bin/grep -lR --include \*.txt --include \*.sh ${WORD} $PATH)
- fi
- echo "$RESULT"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement