From owner-freebsd-questions Sat Sep 7 8:22:15 2002 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 ABF0137B400 for ; Sat, 7 Sep 2002 08:22:11 -0700 (PDT) Received: from ei.bzerk.org (ei.xs4all.nl [213.84.67.5]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7511A43E3B for ; Sat, 7 Sep 2002 08:22:10 -0700 (PDT) (envelope-from fbsd-q@bzerk.org) Received: from ei.bzerk.org (BOFH@localhost [127.0.0.1]) by ei.bzerk.org (8.12.5/8.12.5) with ESMTP id g87FLWeN033410; Sat, 7 Sep 2002 17:21:32 +0200 (CEST) (envelope-from stable@ei.bzerk.org) Received: (from stable@localhost) by ei.bzerk.org (8.12.5/8.12.5/Submit) id g87FLVHW033409; Sat, 7 Sep 2002 17:21:31 +0200 (CEST) Date: Sat, 7 Sep 2002 17:21:31 +0200 From: Ruben de Groot To: Giorgos Keramidas Cc: "Henning, Brian" , questions@FreeBSD.ORG Subject: Re: scripting problems Message-ID: <20020907152131.GA33285@ei.bzerk.org> References: <20020907021348.GB24498@hades.hell.gr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020907021348.GB24498@hades.hell.gr> User-Agent: Mutt/1.4i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sat, Sep 07, 2002 at 05:13:48AM +0300, Giorgos Keramidas typed: > In message: > "Henning, Brian" wrote: > > > > i have this shell script that i am having problems with. when i run > > it (cat output.txt | xargs sh mycheck_sum.sh) i get an error that > > cannot open file. but all the files are there. i am not sure what > > the problem is with this script. can someone take a quick look and > > tell me if they see anything? > > > #! /bin/sh -x > > # cat output.txt | xargs sh mycheck_sum.sh > > > > INPUT=$1 > > SRC=`echo ${INPUT} | awk -F: '{ print $1 }'` > > DST=`echo ${INPUT} | awk -F: '{ print $2 }'` > > xargs will not pass just one argument at a time to your script: > > $ cat > lala > one > two > three > $ xargs echo < lala > one two three > $ You can use the -n switch: $ cat > lala one two three $ xargs -n1 < lala one two three > > You will need to handle all the command line arguments that xargs > passes to your script with something like: > > #!/bin/sh > > for arg in "$@" ;do > # handle $arg > done > > -- > FreeBSD: The Power to Serve -- http://www.FreeBSD.org > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message