• Arun Kumar

Shell Script to Accept User Input

Linux bash script allows you to accept user inputs and read what user types on the screen. This is achieved by Linux read command within the script. In the below script, we will be asking user their favorite color and prompt the user with the input they have typed on the screen.


vi user_input_fav_col.sh
# !/bin/bash
echo -n "What is your favourite colour :"
read answer
echo "oh! you like $answer!"

Here is the sample output of the above script


More ways to use User Input Bash Script

  • Ask user to input their name & output "Welcome " + username

  • Ask user to input their first & last name. Output - "Hello " + first + last name


35 views

Recent Posts

See All

Basic Linux Commands

This article describes basic Linux commands that you must know as a system or database administrator. Below commands in Linux help you manage any Linux server fast and smoothly. Linux Command List Che

Linux Firewall with iptables and firewalld

In this article will be covering details regarding iptables and firewalld which helps in Linux firewall management. We will also be looking at how to enable specific ports (1521 for Oracle) inside ipt

Passwordless SSH in Linux

Every time you ssh from one Linux server to another, you need to enter target server user's password. We can also setup passwordless ssh in Linux between two Linux servers so that you don't have to en

  • Facebook
  • Twitter
  • YouTube
  • Instagram

© 2020 by DBA Genesis