Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Jan 2003 11:20:09 +1100
From:      Tim Robbins <tjr@freebsd.org>
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>

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




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