Sunday, March 11, 2018

macos - $HOME environment variable edit



I have a question which might sound quite naive but I would like to confirm the behavior of the $HOME environment variable on the MAC OS X. I would like to know if we can append paths to the $HOME environment variable just like we do with the $PATH environment variable.



As per my understanding the PATH environment variable looks into all the directory that have been added to it.



Similarly can we not append different directories to the $HOME env variable so that it looks into all those directories? I know this sounds weird because this means the user will have multiple home directories.



If it is not possible to append multiple paths, then my other question is , if the env variable $HOME = "User/name/"




and if I have a file in User/name/subfolder, will this be the same as saving it in the home directory meaning will the search for the file start from the home directory and continue into the subfolders?



I apologize if this seems like a naive question but this is really bugging me and I didn't want to mess around with my $HOME environment variable without knowing the consequences.


Answer




...so that it looks into...




You haven't specified what it is in the above quote. Environment variables are just chunks of text, they don't do anything by themselves. A particular program may interpret an environment variable such as PATH as having multiple paths within it, but that is a matter of generally agreed convention.




The HOME environment variable is generally agreed to point to the one directory that is the user's home directory. There is no searching functionality available.


No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...