- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- validate script args
Categories
Company
Local Language
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
Discussions
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
Community
Resources
Forums
Blogs
- 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
06-17-2002 12:35 PM
06-17-2002 12:35 PM
Thanks,
Greg
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2002 12:44 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2002 12:49 PM
06-17-2002 12:49 PM
Re: validate script args
If you really wanted a reg express, then
[1-9]|1[0-9]|2[0-4]
could be used in an "extend reg expressoin", like-
case "11" in [1-9]|1[0-9]|2[0-4])e cho "yes" ;;
*) echo "no" ;;
esac
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2002 01:04 PM
06-17-2002 01:04 PM
Re: validate script args
#!/usr/bin/sh
STAT=1
until [ ${STAT} -eq 0 ]
do
echo "Enter Hour: \c"
read HR
perl -e 'if ($ARGV[0] =~ /^\d+$/) { if ($ARGV[0] >= 0 && $ARGV[0] <= 24) {exit(0)}}; exit(1);' ${HR}
STAT=$?
if [ ${STAT} -ne 0 ]
then
echo "\07BAD INPUT"
fi
done
If I didn't make a typo that should be a complete solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2002 01:07 PM
06-17-2002 01:07 PM
Re: validate script args
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2002 01:13 PM
06-17-2002 01:13 PM
Re: validate script args
You're being too hard on yourself. Idiots don't get to be Olympians!
:-)
Marty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2002 07:40 AM
06-18-2002 07:40 AM
Re: validate script args
if (( ${1} > 0 && ${1} < 25 ))
then
echo $I is OK
else
echo $I is wrong
fi
Yes, those are double-parenthesis. They are also good for incrementing variables like this:
(( VAR += 1 ))
Be careful preceeding them with "$" because they are arithmetic evaluations.
Enjoy,
-dlt-
BTW: [ ] causes the shell to load test(1) to make the decision; using [[ ]] will avoid the overhead of loading test(1) and put the burden on the quite capable shell.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2002 08:11 AM
06-18-2002 08:11 AM
Re: validate script args
Your point about [[ in lieu of [ is well taken.
Regards, Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2002 09:52 AM
06-18-2002 09:52 AM
Re: validate script args
-- Rod Hills