linux,faqs,howtos,man,forum,squid,mount,ntfs,bandwidth,gnu,opensource,directory
 
Home | Forum | MAN Pages | Tutorials | Directory | HOWTOs | About Me | Contact
You are Browsing Linux HOWTOS
 
FAQS
- Advanced Routing & Traffic Control
- General FAQ
- Squid Proxy Server
- Sendmail
- Fetchmail
- Postfix
- Connecting Mobile Phone
- Paging from Linux
- Standard Commands
- Some common terms
Linux HOWTOs
- Single List of HOWTOs
- AX25-HOWTO
- CD-Writing-HOWTO
- Debian and Windows Shared Printing
- Enterprise Java for Linux HOWTO
- IPCHAINS HOWTO
- HP HOWTO
- - IPX-HOWTO
- Leased-Line
- Linux Gamers HOWTO/
- MMBase
- PA-RISC-Linux-Boot-HOWTO
- Program-Library-HOWTO
- Remote-Boot
- SPARC-HOWTO
- Tips-HOWTO
- Unix-Hardware-Buyer-HOWTO
- Vim-HOWTO
- WWW-mSQL-HOWTO
- Xterm-Title

- ADSL Bandwidth Management
- Compile Apache
- Make a Bootdisk
- Linux-Windows9x-Grub
- Linux-Windows
- Linux Crash Recovery
- Optimise Squid
- Block websites in Squid
- Broadcast webcam in linux
- Compile RedHat Linux kernel
- Implement Firewall Security
- Increase Harddrive Performance
- Mount NTFS filesystem
- Patch / rebuild SRPM
- Secure Linux
- Set up a DHCP Server
- Set up an FTP server
- Set up Linux as a Router
- Use Cron
- Samba
Miscellaneous
- All Ports
- Spammers fetch email addresses
- Mounting NTFS in linux
- Linux Gazette
- Linux Directory
- Linux Man

linux,man,pages,linux man pages,squid,ntfs,mount
  Next Previous Contents

9. User interfaces

9.1 Using select to make simple menus

           #!/bin/bash
           OPTIONS="Hello Quit"
           select opt in $OPTIONS; do
               if [ "$opt" = "Quit" ]; then
                echo done
                exit
               elif [ "$opt" = "Hello" ]; then
                echo Hello World
               else
                clear
                echo bad option
               fi
           done
          

If you run this script you'll see that it is a programmer's dream for text based menus. You'll probably notice that it's very similar to the 'for' construction, only rather than looping for each 'word' in $OPTIONS, it prompts the user.

9.2 Using the command line

          #!/bin/bash        
          if [ -z "$1" ]; then 
              echo usage: $0 directory
              exit
          fi
          SRCD=$1
          TGTD="/var/backups/"
          OF=home-$(date +%Y%m%d).tgz
          tar -cZf $TGTD$OF $SRCD
         

What this script does should be clear to you. The expression in the first conditional tests if the program has received an argument ($1) and quits if it didn't, showing the user a little usage message. The rest of the script should be clear at this point.


Next Previous Contents
 
Random Linux Commands
FTP
File Transfer Protocol, used to send and receive files to and from a remote computer. There are many graphical clients available for Linux, such as Kbear and Gftp.

Common Linux terms
Linux-FAQs Search
linux,faqs,howto,howtos,man,manpages,directory,forum


Linux-FAQs Forum Categories
- About Forum
- Hardware Troubleshooting in Linux
- Linux Entertainment
- Resources
- Software toubleshooting and configuration
Linux-FAQs Man Pages
- About Forum
- Hardware Troubleshooting in Linux
- Linux Entertainment
- Resources
- Software toubleshooting and configuration
All Linux-FAQs Forums
- Crash Recovery
- FAQs
- Forum Talk
- Games
- General
- Linux Audio Support
- Linux Hardware / Driver
- Linux Installation Support
- Linux misc.
- Linux Networking
- Linux Newbies
- Linux Printing Support
- Linux Security
- Linux Video Support
- Mail Server
- Multimedia
- Tutorials
- Web Proxy Server
- Web Server

linux,man,man pages,faqs,howtos,forum
 
Powered by HTML
Linux-faqs.com Copyright, All rights reserved www.linux-faqs.com. Peeyush Maurya.