Welcome to the Treehouse Community
Looking to learn something new?
Why are changes to HOME visible to a daughter bash with out export?
Jim Hoskins clearly demonstrated that changes to PS1 or a newly create environment Variable (MESSAGE) are not passed on to a daughter process (new bash shell). The quiz reinforces this lesson with the question "Environment variables are visible to child processes by default." to which the accepted answer is False.
So please explain the following behavior when reseting the HOME variable (I got the same result on both the treehouse console and my Mac Terminal app)
treehouse ~ $ echo $HOME /home/treehouse treehouse ~ $ mkdir newhome treehouse ~ $ HOME=/home/treehouse/newhome treehouse ~ $ echo $HOME /home/treehouse/newhome treehouse ~ $ bash treehouse@ip-10-170-97-102:/home/treehouse$ echo $HOME /home/treehouse/newhome
Why wasn't export needed? What other environment variables are exempt from the 'local unless exported' rule?
Caleb KleveterTreehouse Moderator 37,862 Points
I would think it would be because of the "HOME=" in "HOME=/home/treehouse/newhome".