Skip to content

Instantly share code, notes, and snippets.

@afunTW
Created April 18, 2016 14:53
Show Gist options
  • Save afunTW/a3b391692fccf53d309a285655fcf236 to your computer and use it in GitHub Desktop.
Save afunTW/a3b391692fccf53d309a285655fcf236 to your computer and use it in GitHub Desktop.
show the query result with color
#!/bin/bash
echo To show a string within ALL files in a given directory. Updated: 2016-01-10
if [ $# -eq 0 ]
then
echo Usage: $0 [directory] [string]
else
echo Showing all \'$2\' under directory \'$1\' ...
grep -R -n --exclude-dir=node_modules --exclude-dir=lib --color=always "$2" "$1"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment