LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   script return to menu (https://www.linuxquestions.org/questions/linux-general-1/script-return-to-menu-576857/)

hraposo 08-13-2007 05:56 PM

script return to menu
 
I made a script like this:

Code:

#!/bin/bash
# script.sh
#gnome-terminal
#xterm
eco ESCOLHA A OPÇÃO?
        echo "1 ) ACTUALIZAR SOURCE LIST."
        echo "2 ) INSTALAR PROGRAMAS."
        echo "3 ) CONFIGURAR O REDWRITE DOS DISCO ."
        echo "4 ) INSTALAR DRIVERS NVIDIA ."
        echo "5 ) SAIR ."
        echo -n "Select an Option: "
        read option
        case "$option" in
        1 )

echo ISTO VAI CONFIGURAR O REPOSITÓRIO!
wget http://192.168.1.4/apache/software/linux/gupsy/sources.list
mv /etc/apt/sources.list /etc/apt/sources.list_backtup
cp -r sources.list /etc/apt/sources.list
#echo "deb http://mirror3.ubuntulinux.nl/ edgy-seveas freenx" >> /etc/apt/sources.list
#echo "deb http://www.agrassi.org/ubuntu feisty adunanza" >> /etc/apt/sources.list
#echo "deb-src http://www.agrassi.org/ubuntu feisty adunanza" >> /etc/apt/sources.list
echo "deb http://ftp.br.debian.org/debian/ etch main contrib non-free" >> /etc/apt/sources.list
echo "deb http://packages.freecontrib.org/ubuntu/plf edgy-plf free non-free" >> /etc/apt/sources.list
echo "deb-src http://packages.freecontrib.org/ubuntu/plf edgy-plf free non-free" >> /etc/apt/sources.list
rm -rf sources.list
echo FIM, DE ACTUALIZAÇÃO
               
                ;;

                2 )
echo INSTALAR ALGUNS PROGRAMAS E CODECS
apt-get install clamav elisa realplayer bluefish restricted-manager freespeak alltray filezilla gftp opera amsn thunderbird pidgin liferea gthumb xchat acroread brasero gomebacker gtk-recordmydesktop soundconverter mplayer gstreamer0.10-ffmpeg gstreamer0.10-gl gstreamer0.10-plugins-base gstreamer0.10-plugins-good gstreamer0.10-plugins-bad gstreamer0.10-plugins-bad-multiverse gstreamer0.10-plugins-ugly gstreamer0.10-plugins-ugly-multiverse libxine-extracodecs w32codecs mplayer flashplayer-nonfree flashplugin-nonfree banshee sun-java6-jre sun-java6-fonts sun-java6-bin sun-java6-plugin sun-java6-jre sun-java6-fonts sun-java6-bin sun-java6-plugin gdesklets gdesklets-data
wget http://www9.limewire.com/download/LimeWireLinux.deb
wget http://dl.google.com/linux/deb/pool/non-free/g/google-desktop-linux/google-desktop-linux_current_i386.deb
wget http://88.198.54.112/pub/getdeb/pd/pdfedit_0.3.1-1~getdeb1_i386.deb
wget http://web.telia.com/~u88005282/sum/archive/deb/startupmanager_1.0.2-2_all.deb
wget http://dl.google.com/linux/deb/pool/non-free/p/picasa/picasa_2.2.2820-5_i386.deb
dpkg -i picasa_2.2.2820-5_i386.deb
dpkg -i LimeWireLinux.deb
dpkg -i google-desktop-linux_current_i386.deb
dpkg -i pdfedit_0.3.1-1~getdeb1_i386.deb
dpk -i startupmanager_1.0.2-2_all.deb
rm -rf *.deb
echo FIM, DA INSTALAÇÃO

                ;;
                3 )

echo AGORA CONFIGURAR O REDWRITE DOS DISCOS
#get all user interaction done right away
echo "deb http://givre.cabspace.com/ubuntu/ dapper main main-all" >> /etc/apt/sources.list
echo "deb http://ntfs-3g.sitesweetsite.info/ubuntu/ dapper main main-all" >> /etc/apt/sources.list
echo "deb http://flomertens.keo.in/ubuntu/ dapper main main-all" >> /etc/apt/sources.list
apt-get install libfuse2 fuse-utils ntfs-3g
echo 'feito'
wget http://kent.dl.sourceforge.net/sourceforge/fuse/fuse-2.6.1.tar.gz
tar zxvf fuse-2.6.1.tar.gz
cd fuse-2.6.1
./configure
make
make install
echo "fuse" >> /etc/modules
modprobe fuse
echo "/dev/hda5 /media/hda5 ntfs-3g defaults,silent,user,auto,umask=0,locale=pt_PT.utf8 0 0" >> /etc/fstab
echo "/dev/hda1 /media/hda1 ntfs-3g defaults,silent,user,auto,umask=0,locale=pt_PT.utf8 0 0" >> /etc/fstab
umount -a
mount -a
echo FIM,COMENTE AS ANTIGAS LINHAS DE HDA1 E HDA5 E FAÇA REBOOT

                ;;
               
                4 )

echo VAMOS INSTALAR OS DRIVERS NVIDIA
wget http://albertomilone.com/ubuntu/nvidia/scripts/envy_0.9.7-0ubuntu6_all.deb                       
dpkg -i envy_0.9.7-0ubuntu6_all.deb
apt-get install -f
rm -rf *.deb
envy -t
                ;;

                5 )

exit 0
                ;;
        esac


Now the one needed to know which the form commands that the menu of script comes back to appear when to finish an option.

Somebody can help?

unSpawn 08-13-2007 06:31 PM

How about wrapping it in 'select' ('help select' in bash)?
Code:

select option in quit choice0 choice1 choice2; do
 case $option in
  choice0) beep -r 10000000000000000
              ;;
  choice1) od -cN2 /dev/random|xargs 2>/dev/null
              ;;
  choice2) # mkfs.msdos -n imlovinit /dev/sda1
              ;;
  quit|*)    echo "Exiting loop."; break
              ;;
 esac
done



All times are GMT -5. The time now is 04:43 AM.