![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Getting user input | stevefox | Shell Programming and Scripting | 3 | 02-15-2007 11:09 PM |
| Creating a Unique ID on distributed systems | pic | High Level Programming | 4 | 05-10-2006 07:25 AM |
| Limiting length of user in while creating user | Satya Mishra | AIX | 2 | 04-14-2005 11:40 PM |
| Script to count unique number of user loged in | elchalateco | Shell Programming and Scripting | 1 | 09-30-2002 08:32 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
creating unique lists from user input
hi all,
I'm trying to resolve a scenario where we prompt the user to enter 1 or more disk names. From there we would run a command on each disk which would give its location. This would allow us to create a list of disks at location A, a list of disks at location B,....etc... Any help on creating these multiple lists? script would do something like: Enter disk(s): disk1 disk2 disk3 disk4 # behind the scenes we would run something like # get_location disk1 (for each disk) # which returns something like NY, Florida, etc... # would set up the unique lists here # then give back to user Disks disk1 disk2 are at location Florida Disk disk3 is at location NY Disk disk4 is at location Boston Our scenerio is a little more complicated than this but I wanted to get it down to the most basic example I could to make the question easier to ask. Any suggestion on how to build these unique lists in my shell script? (sadly we can't use perl here as its cross platform...etc..) thanks Annie |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
printf "Enter disk list: "
read a set "$a" while [ -n "$1" ] ; do echo Working on $1; shift (...do whatever work you need to do...) done -Mike P.S. Don't make the user do too much work. They should be able to enter "1", "2", "3", etc. You can do the rest; example... printf "Enter disk list: " read a set "$a" while [ -n "$1" ] ; do disk="disk$1" echo Working on $disk; shift (...do whatever work you need to do...) done Last edited by mschwage; 11-19-2005 at 10:24 PM. Reason: Another thought... |
|||
| Google The UNIX and Linux Forums |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|