Sponsored Content
Full Discussion: Code Consolidation
Top Forums UNIX for Dummies Questions & Answers Code Consolidation Post 302137126 by misterpinkey on Saturday 22nd of September 2007 09:42:34 AM
Old 09-22-2007
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
 

2 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Apache Subnet consolidation script/routine help needed

I have a rather simple routine that I would like to fine tune. I am having scripters block if that exists. Trying to tally up that amount of subnets after I performed an awk and uniq from zipped apache logs. For instance, on a solaris 10 system: This does work gunzip -c access_log1.200834.gz |... (2 Replies)
Discussion started by: NYG71
2 Replies

2. UNIX for Dummies Questions & Answers

RRDtool consolidation not going as expected

Hello all, I am new to RRDtool and have made a RRDtool database with one data-source. Information of this data-source is stored in four different RRA's with different intervals for different time spans. Database create command: rrdtool create /root/mde.rrd --step 300 \... (2 Replies)
Discussion started by: ArtOfLosing
2 Replies
Gtk2::Clipboard(3pm)					User Contributed Perl Documentation				      Gtk2::Clipboard(3pm)

NAME
Gtk2::Clipboard - wrapper for GtkClipboard HIERARCHY
Glib::Object +----Gtk2::Clipboard METHODS
$clipboard->set_can_store (...) o ... (list) of Gtk2::TargetEntry's Since: gtk+ 2.6 $clipboard->clear display = $clipboard->get_display Since: gtk+ 2.2 clipboard = Gtk2::Clipboard->get_for_display ($display, $selection) o $display (Gtk2::Gdk::Display) o $selection (Gtk2::Gdk::Atom) Since: gtk+ 2.2 clipboard = Gtk2::Clipboard->get ($selection) o $selection (Gtk2::Gdk::Atom) $clipboard->set_image ($pixbuf) o $pixbuf (Gtk2::Gdk::Pixbuf) Since: gtk+ 2.6 object = $clipboard->get_owner $clipboard->request_contents ($target, $callback, $user_data=undef) o $target (Gtk2::Gdk::Atom) o $callback (scalar) o $user_data (scalar) $clipboard->request_image ($callback, $user_data=undef) o $callback (scalar) o $user_data (scalar) Since: gtk+ 2.6 $clipboard->request_rich_text ($buffer, $callback, $user_data=undef) o $buffer (Gtk2::TextBuffer) o $callback (scalar) o $user_data (scalar) Since: gtk+ 2.10 $clipboard->request_targets ($callback, $user_data=undef) o $callback (scalar) o $user_data (scalar) Since: gtk+ 2.4 $clipboard->request_text ($callback, $user_data=undef) o $callback (scalar) o $user_data (scalar) $clipboard->request_uris ($func, $data=undef) o $func (scalar) o $data (scalar) Since: gtk+ 2.14 $clipboard->store Since: gtk+ 2.6 $clipboard->set_text ($text) o $text (string) selectiondata or undef = $clipboard->wait_for_contents ($target) o $target (Gtk2::Gdk::Atom) pixbuf or undef = $clipboard->wait_for_image Since: gtk+ 2.6 list = $clipboard->wait_for_rich_text ($buffer) o $buffer (Gtk2::TextBuffer) Since: gtk+ 2.10 list = $clipboard->wait_for_targets Returns a list of GdkAtom's. Since: gtk+ 2.4 string = $clipboard->wait_for_text scalar = $clipboard->wait_for_uris Since: gtk+ 2.14 boolean = $clipboard->wait_is_image_available Since: gtk+ 2.6 boolean = $clipboard->wait_is_rich_text_available ($buffer) o $buffer (Gtk2::TextBuffer) Since: gtk+ 2.10 boolean = $clipboard->wait_is_target_available ($target) o $target (Gtk2::Gdk::Atom) Since: gtk+ 2.6 boolean = $clipboard->wait_is_text_available boolean = $clipboard->wait_is_uris_available Since: gtk+ 2.14 boolean = $clipboard->set_with_data ($get_func, $clear_func, $user_data, ...) o $get_func (scalar) o $clear_func (scalar) o $user_data (scalar) o ... (list) of Gtk2::TargetEntry's boolean = $clipboard->set_with_owner ($get_func, $clear_func, $owner, ...) o $get_func (scalar) o $clear_func (scalar) o $owner (Glib::Object) o ... (list) of Gtk2::TargetEntry's SIGNALS
owner-change (Gtk2::Clipboard, Gtk2::Gdk::Event) SEE ALSO
Gtk2, Glib::Object COPYRIGHT
Copyright (C) 2003-2011 by the gtk2-perl team. This software is licensed under the LGPL. See Gtk2 for a full notice. perl v5.14.2 2012-05-27 Gtk2::Clipboard(3pm)
All times are GMT -4. The time now is 01:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy