From 7211fe0f3a1d5724bef5e1462995fae6f2a3a343 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Mon, 26 Jul 2021 13:00:36 +0200 Subject: Remove 'g' utility It is better replaced with simple variable declarations: a='* */*' c='*.[ch] */*.[ch]' p='*.p[lm] */*.p[lm]' --- etc/g | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100755 etc/g diff --git a/etc/g b/etc/g deleted file mode 100755 index 7c55707..0000000 --- a/etc/g +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh - -# g -- poor man's ack - -IFS=' -' - -pat= -opt= -i=0 - -while [ $((i++)) -lt $# ]; do - case "$1" in - -*) opt=`printf '%s%s\n' "$opt" $1` - shift ;; - *) break ;; - esac -done - -[ $# -eq 0 ] && { echo usage: $0 [-...] pattern [file ...] 1>&2; exit 1; } - -pat=$1 -shift - -files=`find . -name '*.c' -or -name '*.h' -or -name '*.cc' | sed s,./,,` -[ -z "$files" ] && [ -z "$*" ] && { echo no matching files found 1>&2; exit 1; } - -# todo (?): treat argument \*.x like -or -name \*.x - -p grep $opt -n "$pat" $files "$@" -- cgit v1.2.3