From owner-freebsd-hackers Mon Oct 2 00:19:35 1995 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id AAA19228 for hackers-outgoing; Mon, 2 Oct 1995 00:19:35 -0700 Received: from irz301.inf.tu-dresden.de (irz301.inf.tu-dresden.de [141.76.1.11]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id AAA19221 for ; Mon, 2 Oct 1995 00:19:25 -0700 Received: from sax.sax.de by irz301.inf.tu-dresden.de (8.6.12/8.6.12-s1) with ESMTP id IAA09019; Mon, 2 Oct 1995 08:17:40 +0100 Received: by sax.sax.de (8.6.11/8.6.12-s1) with UUCP id IAA04511; Mon, 2 Oct 1995 08:17:40 +0100 Received: (from j@localhost) by uriah.heep.sax.de (8.6.12/8.6.9) id HAA26723; Mon, 2 Oct 1995 07:30:42 +0100 From: J Wunsch Message-Id: <199510020630.HAA26723@uriah.heep.sax.de> Subject: Re: /bin/sh thinks it's csh To: freebsd-hackers@freebsd.org (FreeBSD hackers) Date: Mon, 2 Oct 1995 07:30:40 +0100 (MET) Cc: taob@io.org Reply-To: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch) In-Reply-To: <199510020015.RAA20655@phaeton.artisoft.com> from "Terry Lambert" at Oct 1, 95 05:15:06 pm X-Phone: +49-351-2012 669 X-Mailer: ELM [version 2.4 PL23] MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Content-Length: 1475 Sender: owner-hackers@freebsd.org Precedence: bulk As Terry Lambert wrote: > > > So argv[0] is the name of the command ("echo") and argv[1] (or $1) > > is the first argument, which is "foo". Why is it proper for POSIX sh > > to return the second argument, "bar"? Is "foo" considered the command ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > name in the above case? ^^^^^^^^^^^^^^^^^^^^^^ > > echo is a builtin. Builtin or not doesn't matter. (Even the builtin echo is executed like any regular command as a different process.) The simple answer to Brian's question is: yes. Here's my commit message again: revision 1.5 date: 1995/10/01 15:11:42; author: joerg; state: Exp; lines: +4 -1 Posixize: sh -c [-aCefinuvx] command_string [ command_name [argument ...] ] ^^ ^^^^^^^^^^^^^^ ^^^^^^^^^^^^ 4.56.3 Options -c Read commands from the command_string operand. Set the ^^^^^^^^ ^^^^^^^^^^^^^^ value of special parameter 0 (see 3.5.2) from the value of ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the command_name operand and the positional parameters ^^^^^^^^^^^^ ($1, $2, etc.) in sequence from the remaining argument operands. Pointed out by: Kaleb Keithley (kaleb@x.org) -- cheers, J"org joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ Never trust an operating system you don't have sources for. ;-)