Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • You can also define functions in your .bashrc. Functions are more flexible than aliases, so you'll probably be able to do what you want.
  • The Advanced Bash-Scripting Guide might profide you with some help. []
  • Look at my program ack, available as a distro in my CPAN directory [].

    It doesn't exclude blib yet, but it does ignore .svn and CVS directories, and it does recursing into directories by default.



  • That's why I use Svk. Well, okay... I use it for other reasons, but that's a nice benefit.

    (No, bash aliases can't take arguments.)

  • I suggest rgrep [] by Michael Schwern.

    This seems like one of those things that seemed "too small to put on CPAN", but probably isn't.

  • In csh, the alias syntax would be:

        alias stringgrep 'grep -r \!* .|grep -vE "svn|blib"'

    I suspect the bash syntax is similar.
    • No, there isn't an equivalent syntax for Bash aliases. This is because in C Shell the ! there is a history substitution, and history works differently in Bash from in C Shell.

      As others have said, use a function; there isn't really any advantage in using a Bash alias over a function (other than you're more likely already to know the alias syntax).

      I think this should do what you want (untested):

      function kerplop
        grep -r "$@" . | grep -vE 'svn|blib'

      (Function name courtesy of meta [].)


  • Bash functions are amazingly useful, and ridiculously simple. Just put something like this in your .bashrc.

    ovidgrep () {
      grep -r "$1" .| grep -vE 'svn|blib'