Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Sep 2002 05:13:48 +0300
From:      Giorgos Keramidas <keramida@ceid.upatras.gr>
To:        "Henning, Brian" <brian.henning@navitaire.com>
Cc:        questions@FreeBSD.ORG
Subject:   Re: scripting problems
Message-ID:  <20020907021348.GB24498@hades.hell.gr>
In-Reply-To: <E1846117A30764468D2192D5A48541CC03894DF2@exchange.Navitaire.com>
References:  <E1846117A30764468D2192D5A48541CC03894DF2@exchange.Navitaire.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020907021348.GB24498>