Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Oct 1995 07:30:40 +0100 (MET)
From:      J Wunsch <j@uriah.heep.sax.de>
To:        freebsd-hackers@freebsd.org (FreeBSD hackers)
Cc:        taob@io.org
Subject:   Re: /bin/sh thinks it's csh
Message-ID:  <199510020630.HAA26723@uriah.heep.sax.de>
In-Reply-To: <199510020015.RAA20655@phaeton.artisoft.com> from "Terry Lambert" at Oct 1, 95 05:15:06 pm

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



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