From owner-freebsd-questions Wed Jan 15 16:20:26 2003 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 D3E9D37B406 for ; Wed, 15 Jan 2003 16:20:23 -0800 (PST) Received: from smtp03.iprimus.com.au (smtp03.iprimus.com.au [210.50.30.52]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8417D43EB2 for ; Wed, 15 Jan 2003 16:20:22 -0800 (PST) (envelope-from tim@robbins.dropbear.id.au) Received: from smtp01.iprimus.net.au (210.50.30.70) by smtp03.iprimus.com.au (6.7.010) id 3E0FA3A200191192 for freebsd-questions@freebsd.org; Thu, 16 Jan 2003 11:20:16 +1100 Received: from dilbert.robbins.dropbear.id.au ([210.50.250.35]) by smtp01.iprimus.net.au with Microsoft SMTPSVC(5.0.2195.5600); Thu, 16 Jan 2003 11:20:15 +1100 Received: from dilbert.robbins.dropbear.id.au (zpxx6koi8rlwmf68@localhost [127.0.0.1]) by dilbert.robbins.dropbear.id.au (8.12.6/8.12.6) with ESMTP id h0G0KBlk062617; Thu, 16 Jan 2003 11:20:12 +1100 (EST) (envelope-from tim@dilbert.robbins.dropbear.id.au) Received: (from tim@localhost) by dilbert.robbins.dropbear.id.au (8.12.6/8.12.6/Submit) id h0G0K9l9062616; Thu, 16 Jan 2003 11:20:09 +1100 (EST) (envelope-from tim) Date: Thu, 16 Jan 2003 11:20:09 +1100 From: Tim Robbins To: i18rabbit@yahoo.com Cc: freebsd-questions@freebsd.org Subject: Re: sh sourcing bug? test bug? Message-ID: <20030116112009.A62339@dilbert.robbins.dropbear.id.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i X-OriginalArrivalTime: 16 Jan 2003 00:20:16.0076 (UTC) FILETIME=[0B33F8C0:01C2BCF5] 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 Chad Kline wrote: > fbsd 4.7 > > SCRIPT > --- > echo 1:$1 > echo 2:$2 > --- > > COMMAND LINE > --- > . ./script x y > --- > > OUTPUT > --- > 1: > 2: > --- > > shouldn't the output be: > 1:x > 2:y Being able to specify command line arguments to the script being sourced is a Korn shell extension that has been adopted by many other shells (bash etc.). FreeBSD's /bin/sh doesn't support this feature, it just ignores the extra arguments. If the script is intended to be portable you'll have to avoid using this feature; otherwise run the script with pdksh, ksh93 or bash. Tim To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message