>From: Alex Rhomberg <[EMAIL PROTECTED]>
You could try test -eq, it returns an error if non-integer parameters are
used:
#!/bin/sh
test $1 -eq $1 2>/dev/null
if test $? -eq 2; then
echo non integer
else
echo integer
fi
- Alex
pn] Thanks, that's elegant when I need to work only with integers. It works on SuSE
8.2 bash, but
not Solaris 8 ksh. Odd.
pn] I tried reading some more on parameter expansion. From my man page...
${parameter#word}
${parameter##word}
The word is expanded to produce a pattern just as in pathname expansion. If the
pattern matches
the beginning of the value of parameter, then the result of the expansion is the
expanded value
of parameter with the shortest matching pattern (the ``#'' case) or the longest
matching pattern
(the ``##'' case) deleted. If parameter is @ or *, the pattern removal operation
is applied
to each positional parameter in turn, and the expansion is the resultant list. If
parameter is an
array variable subscripted with @ or *, the pattern removal operation is applied
to each
member of the array in turn, and the expansion is the resultant list.
pn] I got expansion of the brain just trying to decipher that. Only with Charles'
code as an
example did it make any sense.
pn] Thanks all for the brief but fun Bash 102.
=====
-----
Peter Nosko ([EMAIL PROTECTED])
This is a good place for a tagline.
__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com
-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps
------------------------------------------------------------------------
leaf-user mailing list: [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/leaf-user
SR FAQ: http://leaf-project.org/pub/doc/docmanager/docid_1891.html