![](https://seccdn.libravatar.org/avatar/3f773ea81891e87ae24e797d72e78163.jpg?s=120&d=mm&r=g)
4 May
2008
4 May
'08
20:30
On Sunday 04 May 2008 13:12:54 David C. Rankin wrote:
Listmates, [...] If anyone could shed some light on how it works it would be appreciated. I presume it works based upon the differences in the way string and numerical data is held in memory or in a difference in what [ $AM_I_INT ] actually returns and the way the test is carried out. But that is no more than a guess. If anyone has a need, this is a great solution:
AM_I_INT="$1"
if [ $AM_I_INT -eq $AM_I_INT 2> /dev/null ]; then echo -e "\n\t$AM_I_INT is an integer\n" else echo -e "\n\t$AM_I_INT is not an integer\n" fi
Bash test both arguments for integerness, and issues an error (suppressed by 2>/dev/null) on failure. -- Jim