- [Instructor] Reading n Characters without
pressing the return key.
In the previous video we have learned
about reading the output or sequence of commands.
In this video, we will use the read command
that provides a way to accomplish this task
without having to press return.
Read is an important bash command
to read text from the keyboard or standard input.
We can use read to interactively read
an input from the user, but read is capable of much more.
Most of the input libraries from any programming language
read the input from the keyboard.
But string input termination is done when return is pressed.
There are certain critical situations
when return cannot be pressed.
But the termination is done based
on a number of characters or a single character.
For example, in a game, a ball is moved upward
when + is pressed.
Pressing + and then pressing return every time
to acknowledge the + press is not efficient.
You can use various options of the read command
to obtain different results which we'll see on the screen.
This statement will read n characters
from inputs into the variable_name variable.
For example, read a password in the non echo mode.
Display a message with read string.
Read the input after a timeout, which we're showing here.
For example.
Use a delimiter character to end the input line.
For example.
Awesome.
We've successfully learned how to read n characters
without pressing the return key.
In the next video we'll learn how to
run a command until it succeeds.