- [Lecturer] Grabbing Information about the Terminal.
In the previous video, we've learned about
visiting aliases.
This video helps in collecting
and manipulating terminal settings.
While writing command line shell scripts,
we'll often need to heavily manipulate
information about the current terminal,
such as the number of columns, rows,
cursor positions, masked password fields,
and so on.
TPUT and STTY are utilities that can be used
for terminal manipulations.
Let's see how to use them to perform different tasks.
There are specific information you can gather
about the terminal,
which, as ...
Get the number of columns and rows in a terminal
by using these commands.
Now, to print the current terminal name,
use this command.
Then, to use the cursor to a 100, 100 position,
you can enter ...
Set the background color for this terminal
using this command.
N can be a value in the range zero to seven.
Set the foreground color for text by this command.
N can be a value in the range zero to seven.
To make text bold, use this.
To start and end on the lining, use this.
To delete from the cursor to the end of the line,
use this command.
When typing a password, we should not display
the characters typed.
In this example, we'll see how to do it
using STTY.
Here is the pre-coded file.
The -echo option in receding command
disables the output to a terminal,
whereas echo enables output.
Great!
We've successfully learned about grabbing
information about the terminals.
In the next video, we'll learn how to
get and set dates and delays.