Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

check value is number in cmd

#!/bin/bash

var=a

if [ -n "$var" ] && [ "$var" -eq "$var" ] 2>/dev/null; then
  echo number
else
  echo not a number
fi
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #check #number #cmd
ADD COMMENT
Topic
Name
9+7 =