Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

bash if is number

re='^[0-9]+$'
if ! [[ $yournumber =~ $re ]] ; then
   echo "error: Not a number" >&2; exit 1
fi
Comment

check if variable is a number in bash

re='^[0-9]+$'
if ! [[ $yournumber =~ $re ]] ; then
   echo "error: Not a number" >&2; exit 1
fi
Comment

Bash test if variable is a number

[[ $1 == ?(-)+([0-9]) ]] && echo "$1 is an integer"
Comment

PREVIOUS NEXT
Code Example
Shell :: remote host identification has changed 
Shell :: relead ngix 
Shell :: git clone and create directory 
Shell :: poetry reinstall venv 
Shell :: regex last word in lin 
Shell :: linux get uuid of disk 
Shell :: extract rar centos 
Shell :: ubuntu change primary group 
Shell :: git make new branch 
Shell :: create next app with jest 
Shell :: renaming branch in git 
Shell :: LINUX STRING TO UPPERCASE 
Shell :: apache airflow 
Shell :: find resolution of image terminal linux 
Shell :: installing dbeaver 
Shell :: zip exclude directory 
Shell :: Amend The Most Recent Commit in git command 
Shell :: How to delete dir, subdirectory, fils all in cmd 
Shell :: develop - FETCH_HEAD instead of origin develop 
Shell :: Rename Files in git command 
Shell :: git cherry pick multiple commits 
Shell :: scp command in unix 
Shell :: search command in powershell 
Shell :: cat linux 
Shell :: npm install different version 
Shell :: how to edit a file in terminal windows 
Shell :: powershell and command 
Shell :: bash if else if 
Shell :: how to add filer to git ignore 
Shell :: set up vm arch 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =