Date: Mon, 1 Nov 2004 13:29:23 +0200 From: Giorgos Keramidas <keramida@freebsd.org> To: Alfred Perlstein <alfred@freebsd.org> Cc: tjr@freebsd.org Subject: Re: sh(1) patch Message-ID: <20041101112923.GA16173@orion.daedalusnetworks.priv> In-Reply-To: <20041030085621.GZ24892@elvis.mu.org> References: <20041030085621.GZ24892@elvis.mu.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 2004-10-30 01:56, Alfred Perlstein <alfred@freebsd.org> 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 ---]
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041101112923.GA16173>