Environment Variables in Shell Scripting

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson
Download our mobile app to listen on the go
Get App

Questions and Answers

How can you make an environment variable available to subshells?

  • Using the local command
  • Using the global command
  • Using the export command (correct)
  • Using the import command

How are environment variables set manually?

  • Using the equal-sign assignment operator (correct)
  • Using the colon assignment operator
  • Using the minus-sign assignment operator
  • Using the plus-sign assignment operator

What does $HOSTNAME conventionally hold?

  • The current user's home directory
  • The current user's name
  • The computer's IP address
  • The computer's name (correct)

How can you refer to an environment variable on a bash command line?

<p>Using the echo command (A)</p>
Signup and view all the answers

How can you combine setting an environment variable and making it available to subshells into one line?

<p>$ HOSTNAME=carson.example.com ; export HOSTNAME (C)</p>
Signup and view all the answers

What do environment variables provide the means to pass to programs launched from a shell or a subshell?

<p>Named data (variables) (D)</p>
Signup and view all the answers

How is an environment variable set manually?

<p>Via an equal-sign assignment operator (A)</p>
Signup and view all the answers

What command is used to make an environment variable available to subshells?

<p>export (A)</p>
Signup and view all the answers

What is a subshell?

<p>A child process created by either the shell or a shell script when a program is initiated (B)</p>
Signup and view all the answers

What conventionally holds the computer’s name, such as carson.example.com?

<p>$HOSTNAME (A)</p>
Signup and view all the answers

Flashcards are hidden until you start studying

More Like This

Shell Scripting Basics
15 questions

Shell Scripting Basics

HallowedMajesty avatar
HallowedMajesty
LPIC-1 Topic 105: Shells and Shell Scripting
5 questions
Shell Scripting Essentials
78 questions
Use Quizgecko on...
Browser
Browser