![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how i prepare a c++ code(c code) for implementing my own protocol format | amitpansuria | High Level Programming | 1 | 09-06-2007 11:09 PM |
| IBM Takes Its Own Server Consolidation Medicine - IT Jungle | iBot | UNIX and Linux RSS News | 0 | 08-07-2007 10:30 PM |
| IBM Takes Its Own Server Consolidation Medicine - IT Jungle | iBot | UNIX and Linux RSS News | 0 | 08-02-2007 10:00 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Code Consolidation
My code currently looks like this:
#!/usr/bin/ksh clear while true do clear echo "Menu" echo " 1. WPPHA1" echo " 2. WPPHA2" echo " 3. WPPHA3" echo " 4. WPPHB1" echo " 5. WPPHB2" echo " 6. WPPHC0" echo " 7. WPPHD0" echo " 8. WPPHD1" echo " 9. WPPHD2" echo "10. WPPHD3" echo "11. Exit" echo read choice case $choice in 1) clear cp /usr/asm/data.1182/user_data/reticle_base/reticle_base /usr/asm/data.1182/user_data/reticle_base/reticle_base_temp mv /usr/asm/data.1182/user_data/data_A01/user_data/reticle_base/reticle_base_temp /usr/asm/data.1182/user_data/data_A01/user_data/reticle_base/reticle_base true echo "Copy successful to WPPHA1" read continue $continue clear exit ;; 2) clear cp /usr/asm/data.1182/user_data/reticle_base/reticle_base /usr/asm/data.1182/user_data/reticle_base/reticle_base_temp mv /usr/asm/data.1182/user_data/data_A02/user_data/reticle_base/reticle_base_temp /usr/asm/data.1182/user_data/data_A02/user_data/reticle_base/reticle_base true echo "Copy successful to WPPHA2" read continue $continue clear exit ;; **it keeps doing this exact thing for all choices until 11, which just exits. The only differences for each choice are the things I highlighted in bold (the 3 characters which are short for the tool name & the echo prompt saying that the copy was successful. Is there a way to use a loop or something to consolidate this to make it smaller? esac done Thanks, MP |
|
||||
|
Quote:
Or have each functions name be a prefix followed by a number, then read the number, append to the function prefix then call that. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|