Is Numeric

Check if a string represents a valid number.

Code

General
[[ "$str" =~ ^-?[0-9]*\.?[0-9]+$ ]] && echo "true" || echo "false"

Parameters

The string to check

Server

More Bash Snippets