Skip to content

Instantly share code, notes, and snippets.

@moznion
Created October 12, 2012 06:22
Show Gist options
  • Save moznion/3877609 to your computer and use it in GitHub Desktop.
Save moznion/3877609 to your computer and use it in GitHub Desktop.
grep-alias
#!/usr/bin/env perl
use strict;
use warnings;
my $grep_opt = "--color=auto";
if ($ARGV[0] =~ /^\-/) {
unless ($ARGV[2]) {
system("grep $grep_opt $ARGV[0] $ARGV[1] *");
exit;
}
} else {
unless ($ARGV[1]) {
system("grep $grep_opt $ARGV[0] *");
exit;
}
}
system("grep $grep_opt @ARGV");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment