Can you tell if a C-shell variable is numeric?

Root Boy Jim rbj at nav.icst.nbs.gov
Tue Jul 26 04:51:05 AEST 1988


? From: Vijay Sundaram <sundaram at VX2.GBA.NYU.EDU>

? Hi gurus,

? A question on the C-shell.  I'm writing a C-shell script (no flames please!)
? and I need to determine if a shell variable is a number as opposed to a 
? string.  

expr $var + 0 >& /dev/null || exit

	(Root Boy) Jim Cottrell	<rbj at icst-cmr.arpa>
	National Bureau of Standards
	Flamer's Hotline: (301) 975-5688
	The opinions expressed are solely my own
	and do not reflect NBS policy or agreement
	Careful with that VAX Eugene!



More information about the Comp.unix.questions mailing list