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 :: bash check if variable is number 
Shell :: add ssh to already cloned repo 
Shell :: windows usb serial number 
Shell :: ubuntu ifconfig not found 
Shell :: yii get version 
Shell :: allow localhose wsl2 
Shell :: intellij goto line 
Shell :: insta hack 
Shell :: ubuntu show git branch in terminal 
Shell :: npm forever 
Shell :: uninstall cv2 in pi 
Shell :: access docker ubuntu terminal 
Shell :: docker compose run 
Shell :: dd write iso to usb linux 
Shell :: python win32gui 
Shell :: nuget package manager console reinstall all 
Shell :: choco install npm 
Shell :: INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package com.*.version signatures do not match previously installed version; ignoring! 
Shell :: posh-git installation on PowerShell 
Shell :: change remote url github 
Shell :: ubuntu microphone does not work 
Shell :: powershell elevate to admin within a function 
Shell :: remove first word of pipe output 
Shell :: navigate to drive d cmd 
Shell :: how to install python on linux/terminal 
Shell :: delete git remote heroku 
Shell :: grep multiple 
Shell :: how to install hashcat 
Shell :: snap-update-ns failed with code 1 
Shell :: Error: ENOSPC: System limit for number of file watchers reached, watch 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =