- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Case statement w/input range check
Operating System - Linux
1823177
Members
3976
Online
109647
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-09-2006 02:49 AM
тАО12-09-2006 02:49 AM
Hi. Will this work as is or do I need to modify? I basically want to perform a range check on a given input and perform an action based upon the NUMBER. Thanks.
case ${NUMBER} in
0-99):;;
*) :;;
esac
case ${NUMBER} in
0-99):;;
*) :;;
esac
Solved! Go to Solution.
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-09-2006 03:15 AM
тАО12-09-2006 03:15 AM
Solution
Hi John:
# cat .mycase
#!/usr/bin/sh
typeset NUMBER=$1
case ${NUMBER} in
[0-9] | [0-9][0-9] )
echo "valid number in range"
;;
* )
echo "not a number or out of range"
esac
# ./mycase 77
valid number in range
# ./mycase 100
not a number or out of range
# ./mycase 0
valid number in range
Regards!
...JRF...
# cat .mycase
#!/usr/bin/sh
typeset NUMBER=$1
case ${NUMBER} in
[0-9] | [0-9][0-9] )
echo "valid number in range"
;;
* )
echo "not a number or out of range"
esac
# ./mycase 77
valid number in range
# ./mycase 100
not a number or out of range
# ./mycase 0
valid number in range
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-09-2006 03:31 AM
тАО12-09-2006 03:31 AM
Re: Case statement w/input range check
Thanks for the info!
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Learn About
News and Events
Support
© Copyright 2025 Hewlett Packard Enterprise Development LP