Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Checking file if it was given:
- if [ -z ${1} ]; then echo "File was not given!"; exit 1; fi
- if [ ! -f ${1} ]; then echo "File (${1}) could not be opened!"; exit 1; fi
- # So at this point we know we have a valid file to search in.
- # Reading pattern from standard input:
- echo "Add meg a honapot"
- read i
- if [ -z ${i} ]; then echo "Pattern was not submitted."; exit 1; fi
- # If both the file and the pattern are given, let's grep:
- grep -iw ${i} ${1}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement