1

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.

1 Answer 1

1

...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.

3
  • ya 'it' meant the particular program that would use my HOME env variable and look for a particular file within the directory that is stored in the $HOME env var. Sorry I was unclear about that. So I guess what I meant to ask was if my $HOME env variable was of the form $HOME="User/name:lib/example:lib2/example2" would all these 3 folders be looked into by the program that is using the information within the $HOME env variable?
    – user1009091
    Nov 21, 2012 at 1:52
  • No, you cannot put multiple directories in HOME. Theoretically, a particular program could interpret the HOME environment variable that way, but using multiple directories like that would definitely break all the other programs that don't support multiple directories (and there are going to be a lot of those). Nov 21, 2012 at 1:56
  • haha that's what I thought it might do thanks for saving me from breaking a lot of applications on my computer!
    – user1009091
    Nov 21, 2012 at 6:00

You must log in to answer this question.