home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.shell
- Path: sparky!uunet!ftpbox!mothost!schbbs!maccvm.corp.mot.com!W10075
- From: W10075@maccvm.corp.mot.com (Stephen Weet)
- Subject: Re: How to do $#a in Bourne shell?
- Organization: Motorola
- Date: 10 Sep 1992 08:45:04 CDT
- Message-ID: <1992Sep10.140321.19154@schbbs.mot.com>
- Sender: news@schbbs.mot.com (Net News)
- Nntp-Posting-Host: maccvm.corp.mot.com
- Lines: 44
-
- ------------------------- Original Article -------------------------
- Newsgroups: comp.unix.shell
- Path:
- schbbs!mothost!ftpbox!uunet!europa.asd.contel.com!darwin.sura.net!convex!news.ut
- dallas.edu!corpgate!bnrgate!nrcnet0!cunews!torn!csd.unb.ca!morgan.ucs.mun.ca!nst
- n.ns.ca!dragon.acadiau.ca!merlin!peter
- From: peter@merlin.acadiau.ca (Peter Steele)
- Subject: How to do $#a in Bourne shell?
- Message-ID: <peter.716085132@merlin>
- Sender: news@dragon.acadiau.ca
- Nntp-Posting-Host: merlin
- Organization: Acadia University
- Date: Thu, 10 Sep 1992 00:32:12 GMT
- Lines: 8
-
- If I have a list in Bourne shell, how can I determine how many
- elements are in, short of write a for loop and counting them?
- Bourne shell doesn't seem to have C shell's $#variable construct.
- It doesn't seem to support array indexing either, although I'm just
- learning it and I might be missing something....
- --
- Peter Steele Unix Services Manager peter.steele@acadiau.ca
- Acadia Univ., Wolfville, NS, Canada B0P 1X0 902-542-2201 Fax: 902-542-4364
-
-
-
- Try the following :-
-
- LIST="1 2 3 4 5 6"
- set $LIST # set elements of list as pos params
- echo $# # No . of pos params
-
-
-
-
-
-
-
-
-
-
-
-
-
-