Bash Shell Scripting - Shell Prompt Customization

Bash Shell Scripting - Shell Prompt Customization

Assessment

Interactive Video

Information Technology (IT), Architecture

University

Hard

Created by

Quizizz Content

FREE Resource

This video tutorial explains how to customize the bash shell prompt using the PS1 and PS2 variables. It covers basic and advanced customization techniques, including displaying the username, computer name, time, and date in the prompt. The tutorial also introduces the PS2 variable for handling line continuations and discusses how to persist these customizations using special files and the export command.

Read more

7 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the primary purpose of the PS1 variable in bash?

To store the user's home directory

To define the shell prompt appearance

To manage file permissions

To set the default text editor

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which character is commonly used at the end of a shell prompt?

Asterisk (*)

Dollar sign ($)

Hash (#)

Ampersand (&)

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How can you include the username in the bash prompt using PS1?

By using the $USER variable

By using the @ symbol

By using the %u symbol

By using the \u switch

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the \T switch display in the bash prompt?

The current date

The current directory

The shell version

The time in 12-hour format

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the role of the PS2 variable in bash?

To manage environment variables

To set the default shell

To indicate a continuation line

To display the prompt for a new command

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How can you continue a command on the next line in bash?

By using a period (.)

By using a colon (:)

By using a backslash (\)

By using a semicolon (;)

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What must be done to make shell prompt customizations persist across sessions?

Use the 'save' command

Edit the .bashrc file

Restart the terminal

Use the 'persist' command