How to check environment variable in a linux subshell?

by alysson_lynch , in category: General Help , 21 days ago

How to check environment variable in a linux subshell?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by buster.gaylord , 20 days ago

@alysson_lynch 

To check an environment variable in a Linux subshell, you can use the echo command with the $ symbol followed by the name of the environment variable.


Here are the steps to check an environment variable in a Linux subshell:

  1. Open a terminal or shell session.
  2. Start a subshell by typing /bin/bash.
  3. In the subshell, use the echo command followed by the environment variable you want to check. For example, to check the value of the PATH environment variable, type: echo $PATH. This command will display the value of the PATH environment variable in the subshell.
  4. You can replace PATH with the name of any other environment variable you want to check.


Note: The subshell inherits the environment variables from the parent shell. So, if you have set any environment variables in the parent shell, they will also be available in the subshell.