diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2013-06-20 22:51:35 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2013-06-20 22:51:35 +1200 |
commit | bebbc9bb1c32f3f460ca6d6e81446fcc996dc9d6 (patch) | |
tree | b10dfe3d6269550146c4d1184921f379cd79af83 /bash/bashrc.d/grep.bash | |
parent | Nix DISPLAY, otherwise don't change environment (diff) | |
download | dotfiles-bebbc9bb1c32f3f460ca6d6e81446fcc996dc9d6.tar.gz dotfiles-bebbc9bb1c32f3f460ca6d6e81446fcc996dc9d6.zip |
Massive overhaul of structure for Bash files
* No longer using .bash_logout
* No longer using .bash_profile, using POSIX-compliant .profile
* instead; in particular, moved most of environment settings into
.profile
* Moved some of the separable functionality of both .profile and
.bashrc into subdirectories (some scripts shared, some not)
* Tidied implementation of ls/grep aliases
* Updated install script to reflect all of the above
Diffstat (limited to 'bash/bashrc.d/grep.bash')
-rw-r--r-- | bash/bashrc.d/grep.bash | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/bash/bashrc.d/grep.bash b/bash/bashrc.d/grep.bash new file mode 100644 index 00000000..7cb38c4d --- /dev/null +++ b/bash/bashrc.d/grep.bash @@ -0,0 +1,15 @@ +# Function returns calculated options for grep +function __grepopts { + local grepopts='-I' + grep --help | grep -- --color &>/dev/null \ + && grepopts="${grepopts} --color=auto" + grep --help | grep -- --exclude &>/dev/null \ + && grepopts="${grepopts} --exclude=.git{,ignore,modules}" + grep --help | grep -- --exclude-dir &>/dev/null \ + && grepopts="${grepopts} --exclude-dir=.{cvs,git,hg,svn}" + echo $grepopts +} + +# Alias grep with those options +alias grep="grep $(__grepopts)" + |