HOME, Home and home in tcsh
jd1008
jd1008 at gmail.com
Thu Jun 9 15:49:24 UTC 2016
On 06/08/2016 08:56 PM, Polytropon wrote:
> 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.
>
>
>
>
+1
Shell make no use of $Home.
More information about the freebsd-questions
mailing list