Environment Variables in Shell Scripting
10 Questions
1 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

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</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</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)</p> Signup and view all the answers

    How is an environment variable set manually?

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

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

    <p>export</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</p> Signup and view all the answers

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

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

    More Like This

    Shell Scripting Basics
    15 questions

    Shell Scripting Basics

    HallowedMajesty avatar
    HallowedMajesty
    shell scripting
    21 questions

    shell scripting

    CalmSerpentine8789 avatar
    CalmSerpentine8789
    Use Quizgecko on...
    Browser
    Browser