Date: Sat, 7 Sep 2002 17:21:31 +0200 From: Ruben de Groot <fbsd-q@bzerk.org> To: Giorgos Keramidas <keramida@ceid.upatras.gr> Cc: "Henning, Brian" <brian.henning@navitaire.com>, questions@FreeBSD.ORG Subject: Re: scripting problems Message-ID: <20020907152131.GA33285@ei.bzerk.org> In-Reply-To: <20020907021348.GB24498@hades.hell.gr> References: <E1846117A30764468D2192D5A48541CC03894DF2@exchange.Navitaire.com> <20020907021348.GB24498@hades.hell.gr>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Sep 07, 2002 at 05:13:48AM +0300, Giorgos Keramidas typed: > In message: <E1846117A30764468D2192D5A48541CC03894DF2@exchange.Navitaire.com> > "Henning, Brian" <brian.henning@navitaire.com> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020907152131.GA33285>