How it works...

We used the PS1 shell variable to improve our shell. We add colors in the PS1 variable and the colors were changed. We used the tput command too. This command is also used to modify the settings. setaf sets the foreground color, and setab sets the background color. The color codes for the tput command are as follows:

Code

Color

0

Black

1

Red

2

Green

3

Yellow

4

Blue

5

Magenta

6

Cyan

7

White

Get Bash Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.