Environment and PATH
Understand environment variables and why a command cannot be found.
What you will be able to do
- Use echo $PATH to inspect the search path.
- Use export KEY=value for child processes.
- Keep secrets out of shell history.
- Add local tools to PATH deliberately.
In plain English
PATH is a colon-separated list of directories the shell searches for commands. Environment variables configure programs without editing code. Export a variable to pass it to child processes.
echo "$PATH"
export APP_ENV=development
printenv APP_ENV
command -v nodeYour turn
EasyExport a variable
Export APP_ENV with the value staging and print it.
BASH · starter
APP_ENV=Check your understanding before moving on.
Knowledge checkQuestion 1
Why does ./script.sh work when script.sh alone does not?
Select an answer to continue
Study tools
Make it yours.
Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.
Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign inFinished reading?
Lock in what you just learned.
0%
Mark this lesson complete to save your place and move one step closer to the certificate.