home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!munnari.oz.au!yoyo.aarnet.edu.au!news.adelaide.edu.au!dstos3.dsto.gov.au!tumtum!sct
- Newsgroups: comp.unix.questions
- Subject: Re: How to recognize a csh var as a number?
- Message-ID: <1993Jan26.231002.165645@dstos3.dsto.gov.au>
- From: sct@tumtum (Shaun Troedson)
- Date: 26 Jan 93 23:10:01 CST
- References: <1jn3t3INN88b@haydn.crhc.uiuc.edu>
- Nntp-Posting-Host: tumtum.dsto.gov.au
- X-Newsreader: TIN [version 1.1 PL8]
- Lines: 15
-
- Timothy Tsai (ttsai@crhc.uiuc.edu) wrote:
- : I am reading string values into a csh variable. Depending on whether each
- : string represents a number or not, I want to do certain things. How do I test
- : to see if the variable string is a number or not?
-
- I think this works but its a mess:
-
- echo @ var = $var | csh -t >& /dev/null
-
- The status variable will now contain 1 if 'var' is alpha, 0 if it is num.
- There's probably a less round-about way.
-
- regards
-
- sct.
-