From: Robert Mulley <robert@gnsconsulting.com.au>
Subject: Re: korn shell
Date: 2000/11/14 [thread overview]
Message-ID: <3A1162EC.6DBA7560@gnsconsulting.com.au> (raw)
In-Reply-To: 8urkfl$2i3$1@nnrp1.deja.com
Hello
I believe it means either use the value of $2 or -10. ie if this is in a
script called "george" and you were to run:
./george sort_this_file 27
Then it would sort "sort_this_file" and display to first 27 lines otherwise
if you ran:
./george sort_this_file
it would sort "sort_this_file" and display the first 10 lines.
${2:-10} means either use the value of $2 or if $2 is NULL use the
"default" value -10.
Hope I've explained this to your satisfaction.
Robert Mulley
Unix Admin
tru64man@my-deja.com wrote:
> I'm learning Korn here but I promise I will not flood this newsgroup
> with trivial questions but I'm either lost or I'm an idiot. I'm reading
> the book "Learning the Korn Shell" by Rosenblatt. On page 98 it
> indicates a piece of code that I don't understand.
>
> sort -nr $1 | head -${2:-10}
>
> I know what sort and its options mean, the pipe sign, and the head
> utility--no problem there. But I don't understand the last part
> -${2:-10}
>
> Could someone explain that part to me in somewhat elementary details?
> thanks in advance.
>
> Untru64Man
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
next prev parent reply other threads:[~2000-11-14 5:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-11-14 5:00 korn shell tru64man
2000-11-14 5:00 ` Robert Mulley [this message]
2000-11-14 5:00 ` Lee A. Newcomb
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox