Last active
December 30, 2017 10:37
-
-
Save mattravenhall/cd9c9019f1a981ee13917885c0e414e3 to your computer and use it in GitHub Desktop.
Multiple on-demand grep searches can be tedious, this short script allows user inputs to substitute grep search commands for a specific file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| input='' | |
| if [ "$1" = '' ]; then | |
| input='quit' | |
| echo "Please provide file to search as 'grepWrapper.sh <fileToSearch>'" | |
| fi | |
| while [ "${input}" != 'quit' ]; do | |
| echo "Please provide search sequence, or 'quit':" | |
| read input | |
| grep ${input} $1 | |
| echo '' | |
| done |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The key take-home here is the 'read' command, this principal can be applied to any number of commands. Call as: grepWrapper.sh