From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fa528,bcce8fba79ad8489 X-Google-Attributes: gidfa528,public From: "Lee A. Newcomb" Subject: Re: korn shell Date: 2000/11/14 Message-ID: <3A11CB64.C6BAC88A@zk3.dec.com>#1/1 X-Deja-AN: 693689786 Content-Transfer-Encoding: 7bit References: <8urkfl$2i3$1@nnrp1.deja.com> <3A1162EC.6DBA7560@gnsconsulting.com.au> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: iass@ajo.zk3.dec.com X-Trace: lead.zk3.dec.com 974244747 129852 16.32.176.142 (14 Nov 2000 23:32:27 GMT) Organization: Compaq Computer Corporation, Nashua, NH, US Mime-Version: 1.0 NNTP-Posting-Date: 14 Nov 2000 23:32:27 GMT Newsgroups: comp.unix.tru64 Your explanation is right as to what it does, but slightly wrong in the description: ${2:-10} means if $2 is not null, use its value; otherwise use '10' (not '-10'). If -10 was used, 'sort -nr $1 | head -${2:-10}' would be expanded to 'sort -nr $1 | head --10}' with an error msg. like 'Badly formed number' displayed to stderr. For more detail, do a 'man ksh' and look at the section 'Conditional Substitution' section, which describes the use of ${var:-str}, ${var:=str}, ${var:?str}, ${var:+str}, ... E.g.: ${ variable:-string } If the variable is set and is not null, substitute the value of variable in place of this expression. Otherwise, replace this expression with the value of string. Learning the Korn Shell is a great book. But make sure to check your system's manpage for specific syntax def's. Enjoy ksh, -- lan