Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Oct 1995 19:44:42 +0100 (MET)
From:      Piero Serini <piero@strider.ibenet.it>
To:        terry@lambert.org (Terry Lambert)
Cc:        taob@io.org, kaleb@x.org, hackers@freefall.freebsd.org
Subject:   Re: /bin/sh thinks it's csh
Message-ID:  <199510021844.TAA24648@strider.ibenet.it>
In-Reply-To: <199510012016.NAA20297@phaeton.artisoft.com> from "Terry Lambert" at Oct 1, 95 01:16:48 pm

next in thread | previous in thread | raw e-mail | index | archive | help
Hello.

Quoting from Terry Lambert (Sun Oct  1 21:16:48 1995):
> > > % sh -c 'echo $1' foo bar baz
> > > foo
> > > % csh -c 'echo $1' foo bar baz
> > > foo
...
> >     950726 has this beahviour too, which I always thought was correct.
> > Why would $1 represent anything other than the first argument in argv?
...
>      The const char *arg and subsequent ellipses in the execl(), execlp(), and
>      execle() functions can be thought of as arg0, arg1, ..., argn. Together
>                                              ^^^^
>      they describe a list of one or more pointers to null-terminated strings
>      that represent the argument list available to the executed program.  The
>      first argument, by convention, should point to the file name associated
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>      with the file being executed.  The list of arguments must be terminated
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>      by a NULL pointer.

So, in "sh -c 'echo $0' foo bar baz":

$0	echo
$1	foo

in "csh -c 'echo $0' foo bar baz":

exactly the same.

Bye,
--
#        $Id: .signature,v 1.12 1995/08/14 12:10:54 piero Exp $
Piero Serini                                            Via Giambologna, 1 
<Piero@Free.IT>                                     I 20136 Milano - ITALY



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