Pastebin
API
tools
faq
paste
Login
Sign up
SHARE
TWEET
check-integer-numbers-in-bash-variables-2
tolikpunkoff
Aug 29th, 2016
799
0
Never
Add comment
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!
Bash
0.17 KB
| None
|
0
0
raw
download
clone
embed
print
report
#!/bin/bash
#check integer positive and negative numbers in bash variables
if
(
echo
"$1"
|
grep
-E
-q
"^-?[0-9]+$"
)
;
then
echo
"Number"
else
echo
"Not Number"
fi
Advertisement
Add Comment
Please,
Sign In
to add comment
Public Pastes
Untitled
1 min ago | 30.09 KB
BEST BOOKS 2026
1 hour ago | 4.13 KB
Untitled
2 hours ago | 14.20 KB
Untitled
2 hours ago | 11.91 KB
Untitled
4 hours ago | 18.19 KB
Untitled
4 hours ago | 6.38 KB
Untitled
6 hours ago | 11.50 KB
Untitled
6 hours ago | 12.01 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the
Cookies Policy
.
OK, I Understand
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!