- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: How to define variable ranges like a=20..40 u...
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-03-2004 06:47 PM
06-03-2004 06:47 PM
I need to assign value with in the number range,how to assign to the variable.?
number_range_like=20...40 , selected range number is 15 and variable shoed hold value 15.
Can any one help.
Thanks
Ashan
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2004 06:54 PM
06-03-2004 06:54 PM
Re: How to define variable ranges like a=20..40 using ksh
number_range_like = [ value1,value2,...,valuen ]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2004 07:03 PM
06-03-2004 07:03 PM
Re: How to define variable ranges like a=20..40 using ksh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2004 07:10 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2004 07:33 PM
06-03-2004 07:33 PM
Re: How to define variable ranges like a=20..40 using ksh
Hi Bharat,
How to pick a value from the range and assign
to variable.
num_range="[1, 2, 3, 4, 5 ]" I need select only and test value 2 and 5 and result will
assign to logical condition.
how to do t his
Thanks
Ashan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2004 07:53 PM
06-03-2004 07:53 PM
Re: How to define variable ranges like a=20..40 using ksh
typeset -i x
typeset -i minrange=20
typeset -i maxrange=40
x=$RANDOM*(maxrange-minrange)+minrange
it will pick a random value in [minrange,maxrange[ interval
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2004 07:53 PM
06-03-2004 07:53 PM
Re: How to define variable ranges like a=20..40 using ksh
You can just use positional values by using "cut" command.
Example:
$ numer_range_like="1,2,3,4,5"
$ echo ${number_range_like} | read second fifth
To see the values:
$ echo $second
$ echo $fifth
FYI,
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2004 07:55 PM
06-03-2004 07:55 PM
Re: How to define variable ranges like a=20..40 using ksh
You can just use positional values by using "read" command.
Example:
$ numer_range_like="1,2,3,4,5"
$ echo ${number_range_like} | read second fifth
To see the values:
$ echo $second
$ echo $fifth
FYI,
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2004 07:56 PM
06-03-2004 07:56 PM
Re: How to define variable ranges like a=20..40 using ksh
Sorry, command was incomplete.
You can just use positional values by using "cut" command.
Example:
$ numer_range_like="1,2,3,4,5"
$ echo ${number_range_like} | tr -s "," " " | read second fifth
To see the values:
$ echo $second
$ echo $fifth
FYI,
Mark