Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Jun 2016 04:56:45 +0200
From:      Polytropon <freebsd@edvax.de>
To:        Erich Dollansky <erichsfreebsdlist@alogt.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: HOME, Home and home in tcsh
Message-ID:  <20160609045645.f98518c7.freebsd@edvax.de>
In-Reply-To: <20160609102944.39f0e4c2@X220.alogt.com>
References:  <20160609102944.39f0e4c2@X220.alogt.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 9 Jun 2016 10:29:44 +0800, Erich Dollansky wrote:
> Hi,
> 
> the answer to my question might be so obvious, but I do not know it.
> 
> I use this to set the home for the current project I am working on and
> then use cd $Home to return to the project's home directory:
> 
> setenv home "`pwd`/" 
> setenv Home "`pwd`/"
> 
> 'home' contains always my real home directory. 'Home' contains the
> project's home directory as expected.
> 
> Does anybody know why it is like this?

The variable $home is set by the C shell automatically, similarly
as it does "set path = (... list of path elements ...)"; $home is
set like $HOME by the shell itself and should not be altered by
the user (without purpose). :-)

>From "man csh":

       The character `~' at the beginning of a filename refers to home  direc-
       tories.   Standing  alone,  i.e., `~', it expands to the invoker's home
       directory as reflected in the value of the home shell  variable.

[...]

   Special shell variables
       The  variables  described  in  this section have special meaning to the
       shell.

       The  shell  sets  addsuffix,  argv,  autologout,  csubstnonl,  command,
       echo_style,  edit,  gid,  group,  home,  loginsh,  oid,  path,  prompt,
       prompt2, prompt3, shell, shlvl, tcsh, term, tty, uid, user and  version
       at  startup;  they do not change thereafter unless changed by the user.
       The shell updates cwd, dirstack, owd and  status  when  necessary,  and
       sets logout on logout.

       The shell synchronizes group, home, path, shlvl, term and user with the
       environment variables of the same names: whenever the environment vari-
       able  changes  the  shell  changes  the corresponding shell variable to
       match (unless the shell variable is read-only) and  vice  versa.   Note
       that  although  cwd  and PWD have identical meanings, they are not syn-
       chronized in this manner, and that the  shell  automatically  intercon-
       verts the different formats of path and PATH.

[...]

       home    Initialized to the home directory of the invoker.  The filename
               expansion of `~' refers to this variable.

[...]

       HOME    Equivalent to the home shell variable.




-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160609045645.f98518c7.freebsd>