Skip to content

Instantly share code, notes, and snippets.

@abdulbadii
Last active September 28, 2018 20:16
Show Gist options
  • Save abdulbadii/ef33a8a38e28c376466be406238edb68 to your computer and use it in GitHub Desktop.
Save abdulbadii/ef33a8a38e28c376466be406238edb68 to your computer and use it in GitHub Desktop.
#! /usr/bin/bash
g() {
unset c l s f
for a
{
if [[ $a =~ ^- ]] ;then
test "${a:1:1}" = l &&l=1
else
if test ! $s ;then s=$a
elif test ! $f ;then f=$a;fi
fi
let c++
}
test $l &&s="\Q$s\E"
case $c in
1) gre --color=always -Hine "$s" --include='\.(txt|ini|c.?.?|js.?.?|dat|cmd|h|htm.?|log|reg|\w*rc|sh)$|^(configure|makefile|readme)' -r .;;
[23]) gre --color=always -Hiane "$s" --include="\.$f" -r .;;
esac
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment