[Novalug] find or not really or?
shawn wilson
ag4ve.us@gmail.com
Wed May 20 00:11:51 EDT 2015
My eyes are bleeding - wth does that do?
Based on sh and not bash, I'm guessing this is fixing something w/
non-gnu find but I don't se it (still dealing with eye blood)
On Tue, May 19, 2015 at 7:02 PM, James Ewing Cottrell, III via Novalug
<novalug@firemountain.net> wrote:
> Time to post this again.....
>
> #! /bin/sh
> # $Id: ff 271 2013-10-17 14:10:27Z JECottrell3@gmail.com $
>
> DIR=
> OPT=
> ACT=-print
> DOIT=eval
>
> while : $# $*
> do
> case $1 in
> ('') break;; # DONE
> (-\?) exec ${PAGER:-less} $0;; # HELP
> (-j) DOIT=echo; shift 1;; # DEBUG
> (-[amc])OPT="$OPT ${1}time '$2'"; shift 2;; # Times
> (-e) OPT="$OPT -empty"; shift 1;; # Empty
> (-g) OPT="$OPT -group '$2'"; shift 2;; # Group
> (-I) OPT="$OPT -inum '$2'"; shift 2;; # Inode
> (-L) OPT="$OPT -links '$2'"; shift 2;; # Links
> (-n) OPT="$OPT -name '$2'"; shift 2;; # Name
> (-i) OPT="$OPT -iname '$2'"; shift 2;; # Any Case
> (-p) OPT="$OPT -perm '$2'"; shift 2;; # Perms
> (-s) OPT="$OPT -perm +6000"; shift 2;; # Set[ug]id
> (-t) OPT="$OPT -type '$2'"; shift 2;; # Type
> (-[bdfl])OPT="$OPT -type ${1#-}";shift 1;; # File/Dir/etc
> (-u) OPT="$OPT -user '$2'"; shift 2;; # User
> (-y) OPT="$OPT -newer '$2'"; shift 2;; # Younger
> (-z) OPT="$OPT -size '$2'"; shift 2;; # Size Matters
> (-o) OPT="$OPT -o"; shift 1;; # Logical OR
> (-1) OPT="$OPT -xdev"; shift 1;; # One File System
> (-rm) OPT="$OPT -delete"; shift 1;; # Remove
> (-x) shift; ACT="-exec $@ +"; break ;; # New Exec
> (-ls) ACT="-ls"; shift 1;; # List
> (-k) ACT="-printf '%k\t%f\n'"; shift 1;; # Size/File
> (-w) ACT="-printf '%k\t%h/%f\n'";shift 1;; # Size/Whole
> (-no*) OPT="$OPT '$1'"; shift 1;; # Known Unary
> (-) OPT="$OPT '-$2'"; shift 2;; # Unary Syntax
> (-*) OPT="$OPT '$1' '$2'"; shift 2;; # Binary Syntax
> ([\!\(\)])OPT="$OPT '$1'"; shift 1;; # Grouping
> (*) DIR="$DIR $1"; shift 1;; # Directories
> esac
> done
> $DOIT find ${DIR:-.} $OPT $ACT
>
> JIM
> **********************************************************************
> The Novalug mailing list is hosted by firemountain.net.
>
> To unsubscribe or change delivery options:
> http://www.firemountain.net/mailman/listinfo/novalug
More information about the Novalug
mailing list