# HG changeset patch # User Noah Evans # Date 1316075534 -7200 # Node ID 986a76e92d0f2adb9293604acd67c8100b685262 # Parent ab47b768d913e5aa15c30c3fae9853b93804ef0e g: too useful not to have in the main distro. R=john, nemo, nemo.mbox CC=nix-dev, rminnich http://codereview.appspot.com/5005042 diff -r ab47b768d913 -r 986a76e92d0f rc/bin/g --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rc/bin/g Thu Sep 15 10:32:14 2011 +0200 @@ -0,0 +1,16 @@ +#!/bin/rc + +if(~ $#* 0 1){ + what=$1 + if(~ $#what 0) + what=`{cat} + files=() + for(f in *){ + if(file -m $"f | grep -s text/ ) + files=($files $"f) + } + + if(! ~ $#files 0) + grep -n -- $what $files /dev/null +} +if not grep -n $* /dev/null