Use Read Operator In Script | Bash Shell Scripting Tutorial For Beginners | Session -3

Veröffentlicht am: 01 January 1970
auf dem Kanal: Nehra Classes
3,263
97

How To take Input From The User in Script: (Using read variable)
===================================================
Use Read Operator In Script | Bash Shell Scripting Tutorial For Beginners | Session -3
================
How to use Read operator in any script takes the input from the user and saves it in the variable which we have assign to it.

1. Accept single input from the user.

echo "Please Enter Your Name"
read name
echo "Your Name is $name"

2. Accept multiple inputs from the user.

echo "Please Enter The Names"
read name1 name2 name3 name4
echo "The Entered Names are: $name1 $name2 $name3 $name4"

3. To take the inputs on the same line of the prompt message.

read -p 'Enter Name Here: ' name
echo "Your Name is $name"

4. To take the silent (hidden) input from the user e.g. password.

read -p 'Enter Name Here: ' name
read -sp 'Enter Your Password: ' password
echo "Your Name is $name"
echo "Your Password is $password"

5. To avoid overlapping of lines use echo operator in between.
read -p 'Enter Name Here: ' name
read -sp 'Enter Your Password: ' password
echo
echo "Your Name is $name"
echo "Your Password is $password"

6. Allow the user to enter multiple inputs and save them in an array.

echo "Enter The Names: "
read -a names
echo "The Entered Names are: ${names[0]} ${names[1]} ${names[2]}"

7. Use built in reply variable.

echo "Enter Your Name: "
read
echo "Your Name is $REPLY"

===
nehra classes,vikas nehra,bourne shell and programming,bash scripting,unix,tutorials,learning,operating,system,os,beginners,basics,system calls,korn,bourne,shell,programming,utilities,file system,directories,memory management,special variables,vi editor,processes,what is shell?,using shell variables,bash,csh,ksh,tcsh,zsh,/bin/sh,/bin/bash,learn shell scripting from basics to advanced,bash scripting tutorial for beginners,comments,variables
===
Thanks for watching the video. If it helped you then, please do like & share it with others as well. Feel free to post your queries & suggestions, we will be glad to answer your queries.
If you like our hard work then do subscribe to our channel & turn on the bell notification for latest updates.
===
Contact Us:
Follow our all social media accounts @NehraClasses
Vikas Nehra's Twitter Handle: http://bit.ly/VikasNehraTwitterHandle
Vikas Nehra's FB Account:   / er.vikasnehra  
Vikas Nehra's Instagram Handle:   / er.vikasnehra  
Registration Form: http://bit.ly/NehraClassesRegForm
Twitter Handle: http://bit.ly/NehraClassesTwiiterHandle
Facebook Page: www.facebook.com/nehraclasses
Instagram:   / nehraclasses  
Telegram Channel: https://t.me/NehraClasses
WhatsApp Us: https://bit.ly/2Kpqp5z
Email Us: [email protected]
===
©COPYRIGHT. ALL RIGHTS RESERVED.


Auf dieser Seite können Sie das Online-Video Use Read Operator In Script | Bash Shell Scripting Tutorial For Beginners | Session -3 mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Nehra Classes 01 January 1970 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 3,263 Mal angesehen und es wurde von 97 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!