Saturday, May 31, 2008

Fuzzy check if a bash input is string or a number

Couldn't think of anything better. Please leave comments if anything better exists.

#!/bin/bash
read -p "[*] input" in

if [ $((in+1)) -eq 1 ]
then
 echo "input is a STRING"
else
 echo "input is a number"
fi


0 comments:

Post a Comment