From owner-freebsd-questions@FreeBSD.ORG Fri Sep 8 13:16:35 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 57E7B16A4E1 for ; Fri, 8 Sep 2006 13:16:35 +0000 (UTC) (envelope-from matt@gsicomp.on.ca) Received: from gabby.gsicomp.on.ca (CPE00062566c7bb-CM0011e6ede298.cpe.net.cable.rogers.com [70.28.254.189]) by mx1.FreeBSD.org (Postfix) with ESMTP id E7C5E43D45 for ; Fri, 8 Sep 2006 13:16:34 +0000 (GMT) (envelope-from matt@gsicomp.on.ca) Received: from localhost (localhost [127.0.0.1]) by gabby.gsicomp.on.ca (Postfix) with ESMTP id 6B96960FA; Fri, 8 Sep 2006 10:09:42 -0400 (EDT) Received: from unknown by localhost (amavisd-new, unix socket) id client-bOf1VhcU; Fri, 8 Sep 2006 10:09:28 -0400 (EDT) Received: from hermes (hermes.gsicomp.on.ca [192.168.0.18]) by gabby.gsicomp.on.ca (Postfix) with ESMTP id 8FECC60F6; Fri, 8 Sep 2006 10:09:28 -0400 (EDT) Message-ID: <005401c6d349$3897bea0$0000fea9@gsicomp.on.ca> From: "Matt Emmerton" To: , References: <45016BBC.8080803@kth.se> Date: Fri, 8 Sep 2006 09:18:05 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1807 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1807 X-Virus-Scanned: amavisd-new at gsicomp.on.ca Cc: 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 13:16:35 -0000 > If I have two files "foo" and "bar" and try to run diff on them I write: > $diff foo bar > I can also write > $cat foo | diff - bar > But how do I give a program two (2) commands? not only to diff > but to any program that wants double input... > I wanna do > $cat foo | cat bar | diff - - > especially with echo commands that would be handy so I dont have to > create files! You don't. Recall that | is the "pipe" operator, and like in real life, there's one input and one output. Pipes used on the command line are for all intents and purposes "unnamed", and you can only build up one "pipeline". That's why named pipes were invented, so that you could have multiple pipes and refer to them by name (instead of implicitly). But in your case, using named pipes is really no different than using files. -- Matt Emmerton