From owner-freebsd-questions@FreeBSD.ORG Fri Sep 8 14:28:51 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 816EA16A4F0 for ; Fri, 8 Sep 2006 14:28:51 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id DD7D943D66 for ; Fri, 8 Sep 2006 14:28:46 +0000 (GMT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.13.6/8.13.6) id k88ESjNO092591; Fri, 8 Sep 2006 09:28:45 -0500 (CDT) (envelope-from dan) Date: Fri, 8 Sep 2006 09:28:45 -0500 From: Dan Nelson To: David King Message-ID: <20060908142842.GB30620@dan.emsphone.com> References: <45016BBC.8080803@kth.se> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-OS: FreeBSD 6.1-STABLE X-message-flag: Outlook Error User-Agent: Mutt/1.5.13 (2006-08-11) Cc: lassee@kth.se, freebsd-questions@freebsd.org Subject: Re: How do I give 2 parameters to programs in an unix enviroment? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Sep 2006 14:28:51 -0000 In the last episode (Sep 08), David King said: > Here's an example using zsh (I assume it's the same using bash, but > different using tcsh or sh): > > diff <(find /usr/local -type f | sort) <(for each in /var/db/pkg/*/ > +CONTENTS; do grep -v '^@' $each; done | sort) > > This does a diff(1) of what /var/db/pkg says that /usr/local should > look like, and what it *really* looks like (note that it would need > some tuning in order to actually be useful, but you get the idea) > > This uses the <() operator. What the <() operator does is create a > named pipe in /tmp, execute the commands contained in the parenthesis > in a subshell, and connect the stdout of the subshell into that named > pipe. So it's sort of like using temp files, but you don't have to > clean up after yourself. There's another, similar operator that does > force it to use temp files, but I can never remember what it is :) > Check the manpages for your shell Just for the archives, The =() operator puts the output to a temp file and returns the filename to the main command. It has to wait for the subshell to finish before running the main command, though. -- Dan Nelson dnelson@allantgroup.com