From owner-freebsd-doc@FreeBSD.ORG Mon Nov 1 11:29:28 2004 Return-Path: Delivered-To: freebsd-doc@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B6D8516A4D9; Mon, 1 Nov 2004 11:29:28 +0000 (GMT) Received: from aiolos.otenet.gr (aiolos.otenet.gr [195.170.0.23]) by mx1.FreeBSD.org (Postfix) with ESMTP id AD8B543D3F; Mon, 1 Nov 2004 11:29:27 +0000 (GMT) (envelope-from keramida@freebsd.org) Received: from orion.daedalusnetworks.priv (aris.bedc.ondsl.gr [62.103.39.226])iA1BTOv0031442; Mon, 1 Nov 2004 13:29:25 +0200 Received: from orion.daedalusnetworks.priv (orion [127.0.0.1]) iA1BTNIj029207; Mon, 1 Nov 2004 13:29:23 +0200 (EET) (envelope-from keramida@freebsd.org) Received: (from keramida@localhost)iA1BTNAw029206; Mon, 1 Nov 2004 13:29:23 +0200 (EET) (envelope-from keramida@freebsd.org) Date: Mon, 1 Nov 2004 13:29:23 +0200 From: Giorgos Keramidas To: Alfred Perlstein Message-ID: <20041101112923.GA16173@orion.daedalusnetworks.priv> References: <20041030085621.GZ24892@elvis.mu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20041030085621.GZ24892@elvis.mu.org> cc: doc@freebsd.org cc: ru@freebsd.org cc: tjr@freebsd.org Subject: Re: sh(1) patch X-BeenThere: freebsd-doc@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Documentation project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Nov 2004 11:29:29 -0000 On 2004-10-30 01:56, Alfred Perlstein wrote: > I always find it kind of difficult to find the $foo special operators > under the manpage for sh(1) because they are not listed in a way > that allows easy search. > > Would this patch be acceptable? > Index: sh.1 > =================================================================== > RCS file: /home/ncvs/src/bin/sh/sh.1,v > retrieving revision 1.92 > diff -u -r1.92 sh.1 > --- sh.1 3 Jul 2004 02:03:44 -0000 1.92 > +++ sh.1 30 Oct 2004 08:54:52 -0000 > @@ -952,7 +952,7 @@ > The value of the parameter is listed > next to its character. > .Bl -hang > -.It Li * > +.It Li $* > [snip] Hi Alfred, The patch is probably ok as an idea, but it's not quite finished if you only change the names of the special variables to include `$'. The paragraph just above the changes says: : Special Parameters : A special parameter is a parameter denoted by one of the following : special characters. The value of the parameter is listed next to : its character. This has to be changed too, if you change the list of variable names to include the `$' character. The best I could come up with was something like the following diff. Does this look any better to you? [--- sh-special.patch starts here ---] Index: sh.1 =================================================================== RCS file: /home/ncvs/src/bin/sh/sh.1,v retrieving revision 1.92 diff -u -u -r1.92 sh.1 --- sh.1 3 Jul 2004 02:03:44 -0000 1.92 +++ sh.1 1 Nov 2004 11:27:04 -0000 @@ -947,12 +947,16 @@ .Ic set built-in command can also be used to set or reset them. .Ss Special Parameters -A special parameter is a parameter denoted by one of the following -special characters. -The value of the parameter is listed -next to its character. +A special parameter is a parameter denoted by a special one-character +name. +The special parameters recognized by the +.Nm +shell of +.Fx +are shown in the following list, exactly as they would appear in input +typed by the user or in the source of a shell script. .Bl -hang -.It Li * +.It Li $* Expands to the positional parameters, starting from one. When the expansion occurs within a double-quoted string @@ -965,7 +969,7 @@ if .Ev IFS is unset. -.It Li @ +.It Li $@ Expands to the positional parameters, starting from one. When the expansion occurs within double-quotes, each positional @@ -988,26 +992,26 @@ .Bd -literal -offset indent "abc" "def ghi" .Ed -.It Li # +.It Li $# Expands to the number of positional parameters. -.It Li \&? +.It Li $\&? Expands to the exit status of the most recent pipeline. -.It Li - +.It Li $- (hyphen) Expands to the current option flags (the single-letter option names concatenated into a string) as specified on invocation, by the set built-in command, or implicitly by the shell. -.It Li $ +.It Li $$ Expands to the process ID of the invoked shell. A subshell retains the same value of $ as its parent. -.It Li \&! +.It Li $\&! Expands to the process ID of the most recent background command executed from the current shell. For a pipeline, the process ID is that of the last command in the pipeline. -.It Li 0 +.It Li $0 (zero) Expands to the name of the shell or shell script. .El .Ss Word Expansions [--- sh-special.patch ends here ---]