From owner-freebsd-hackers Mon Aug 19 07:01:26 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id HAA17351 for hackers-outgoing; Mon, 19 Aug 1996 07:01:26 -0700 (PDT) Received: from brasil.moneng.mei.com (brasil.moneng.mei.com [151.186.109.160]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id HAA17343 for ; Mon, 19 Aug 1996 07:01:23 -0700 (PDT) Received: (from jgreco@localhost) by brasil.moneng.mei.com (8.7.Beta.1/8.7.Beta.1) id JAA19138; Mon, 19 Aug 1996 09:00:21 -0500 From: Joe Greco Message-Id: <199608191400.JAA19138@brasil.moneng.mei.com> Subject: Re: how /etc/security works To: rif@ns.kconline.com (Jim Riffle) Date: Mon, 19 Aug 1996 09:00:21 -0500 (CDT) Cc: hackers@FreeBSD.org Reply-To: questions@FreeBSD.org In-Reply-To: from "Jim Riffle" at Aug 19, 96 07:57:11 am X-Mailer: ELM [version 2.4 PL24] Content-Type: text Sender: owner-hackers@FreeBSD.org X-Loop: FreeBSD.org Precedence: bulk > I feel like a total fool, but I am having troubles deciphering exactly how > /etc/security works. > Here is what troubles me.. > > MP=`mount -t ufs | sed 's;/dev/;&r;' | awk '{ print $3 }'` > set $MP > while test $# -ge 1; do > mount=$1 > shift > find $mount -xdev \( -perm -u+s -or -perm -g+s \) | sort > done | xargs -n 20 ls -lgTd > $TMP > > ---------------------- > > I understand the find command, but the rest of that, I am just not sure as > to what is really going on. In the end, what I am wanting to do is have > it skip /var/news alltogether while doing find on everything else. Could > one of you sh wizards please decipher this for me? This probably belongs on -questions... MP=`mount -t ufs | grep -v " on /news " | sed 's;/dev/;&r;' | awk '{ print $3 }'` would probably be sufficient... oops, /var/news for you. As for what's going on... The MP= sets the variable "MP" to have a list of all the "ufs" filesystems locally (the keys are the mount and the awk, step through the commands adding one at a time to the pipeline to see the effect). The "set" essentially tells sh that you intend to start manipulating the following variable as though it was your argument list. The "while test" checks to see if there are remaining elements in the list. The mount=$1 assigns "${mount}" the value of the first element. The shift deletes the first element and moves elements 2 to N down to 1 to N-1. In this manner, the "find" command is fed each element of "${MP}" in turn. This ends up producing a list of all local files on all local filesystems meeting the "find" criteria. Pipe all that into xargs (read the man page) and get a listing. :-) ... JG