Read user input in Bash shell scripting

 Read command is of the most used command in Bash shell scripting, it useful for read the data from input devices.

simple example for read user input data from below.

#!/bin/bash
echo "Enter name : "
read name
echo "entered name : $name"
echo "Enter name : "
read name
echo "Enter place : "
read place
echo "Enter phone : "
read phone
echo "entered name : $name"
echo "entered name : $place"
echo "entered name : $phone"

here,when we run this script, it will ask for "Enter Name:" after entered name, it stores in $name here echo is used to print output like "Entered name is 7hills".



Comments

Popular posts from this blog

Awk command with simple examples

Learn Linux in Telugu | Linux complete Free Course in Telugu by 7Hills

rsync Command Examples | rsync Command In Telugu