Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

LPI 010-160 Exam - Topic 2 Question 72 Discussion

Which of the following commands sets the variable USERNAME to the value bob?
E) USERNAME=bob
A) set USERNAME bob
B) $USERNAME==bob
C) var USERNAME=bob
D) USERNAME<=bob

LPI 010-160 Exam - Topic 2 Question 72 Discussion

Actual exam question for LPI's 010-160 exam
Question #: 72
Topic #: 2
[All 010-160 Questions]

Which of the following commands sets the variable USERNAME to the value bob?

Show Suggested Answer Hide Answer
Suggested Answer: E

The correct command to set the variable USERNAME to the value bob is USERNAME=bob. This command assigns the string bob to the variable name USERNAME, using the equal sign (=) as the assignment operator. There is no space around the equal sign, and the variable name and value are case-sensitive. This command sets a shell variable, which is only valid in the current shell session. To make the variable an environment variable, which can be inherited by child processes and subshells, you need to use the export command, such as export USERNAME=bob. The other commands are not valid for setting variables in Linux. The set command is used to set or unset shell options and positional parameters, not variables. The $ sign is used to reference the value of a variable, not to assign it. The == sign is used for comparison, not assignment. The var keyword is not used in Linux, but in some other programming languages. The <= sign is used for redirection, not assignment.Reference:

Linux Essentials - Linux Professional Institute (LPI)

How to Set and List Environment Variables in Linux | Linuxize


Contribute your Thoughts:

0/2000 characters

Currently there are no comments in this discussion, be the first to comment!


Save Cancel