• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
sharadchhetri

sharadchhetri

Tutorials On Linux, Unix & Open Source

  • Home
  • Linux Commands
  • Resources
    • Learn Linux
  • My WordPress plugins

How To Use opt In Bash Script

May 15, 2011 by Sharad Chhetri Leave a Comment

How To Use opt In Bash Script,Example

This is an exmaple of how to create bash script with Opt in.

#!/bin/bash
echo "Select no. for option"
OPTIONS="Hello LinuxTribe Quit"
select opt in $OPTIONS; do
if [ "$opt" = "Quit" ]; then
echo done
exit
elif [ "$opt" = "Hello" ]; then
echo Hello World
elif [ "$opt" = "LinuxTribe" ]; then
echo "Welcome in LinuxTribe"
else
clear
echo bad option
echo "Type no. 1,2 or 3 for Hello,LinuxTribe and Quit options respectively"
fi
done

Share this:

  • Twitter
  • Facebook
  • More
  • Print
  • Email
  • LinkedIn
  • Reddit
  • Tumblr
  • Pinterest
  • Pocket
  • Telegram
  • WhatsApp
  • Mastodon

Related posts:

  1. How to Use Expect In Bash Script
  2. How To Use case in Bash Script, Example
  3. Set and reset user password by bash script
  4. send email after mysql backup through bash script in simple way
  5. Xen Server License Nagios Plugin (bash script)
  6. Nagios plugin check_mailfromd bash script
  7. MySQL backup bash script
  8. Replace keyword with its filename without extension : bash script
  9. Install VirtualBox On Ubuntu 22.04 LTS Desktop (Bash Script)
  10. bash scripting : Prompt user yes / no for confirmation

Filed Under: Linux Tagged With: bash script

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Our Social Media Presence

  • Facebook
  • GitHub
  • Twitter

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Linux Commands

Head command in Linux / Unix

Temporarily change the shell after login

vi : Edit file without opening it

How to make rm -fr command to be interactive

create a system account below uid 500 on RHEL/CentOS/Scientific Linux

Command to create and delete group in Red Hat and CentOS linux

6 important examples of cd command on Linux and Unix Systems

Explore 70+ Articles On Linux Commands

Always Useful Tips And Tricks

How to change login banner message in GUI mode in CentOS 6 or above version.

How to add/install Ubuntu fonts in CentOS/Red Hat Linux

How to forcefully send mail from mailq in sendmail MTA

error could not configure a c compiler Linux

Convert video file into gif file through command line in linux

Protect from w00tw00t.at.blackhats.romanian.anti-sec

Replace keyword with its filename without extension : bash script

Explore 90+ Article On "Linux Tips And Tricks"

You Might Like These Articles!

Internal External Command

What is Linux/Unix Internal And External Command

Linux basic command

Linux Basic Commands For Every Beginner

simplecodesyntax wordpress plugin

SimpleCodeSyntax : My Another WordPress Plugin

Install Nginx

How To Install Nginx On Ubuntu 22.04 LTS

Install Latest Git package in Ubuntu Operating System

How To Always Install Latest Git Package In Ubuntu Operating System

Bash script for installing VirtualBox on Ubuntu 22.04 LTS Desktop

Install VirtualBox On Ubuntu 22.04 LTS Desktop (Bash Script)

Copyright © 2023 ยท
The material in this site cannot be republished either online or offline, without our permission but Schools and Colleges can do in their Private Network
Proudly Blogging From Bharat.

  • Contact
  • About Me
  • My WordPress plugins
  • Privacy Policy