Discussion:
HOME, Home and home in tcsh
(too old to reply)
Erich Dollansky
2016-06-09 02:29:44 UTC
Permalink
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?

Thanks!

Erich
Polytropon
2016-06-09 02:56:45 UTC
Permalink
Post by Erich Dollansky
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
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, ...
Erich Dollansky
2016-06-09 03:03:30 UTC
Permalink
Hi,

On Thu, 9 Jun 2016 04:56:45 +0200
Post by Polytropon
Post by Erich Dollansky
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
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). :-)
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
I obviously missed it here.
Post by Polytropon
HOME Equivalent to the home shell variable.
Now I know that it does fall down from the blue sky.

Thanks!

Erich
jd1008
2016-06-09 15:49:17 UTC
Permalink
Post by Polytropon
Post by Erich Dollansky
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
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). :-)
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.
Erich Dollansky
2016-06-09 23:25:03 UTC
Permalink
Hi,

On Thu, 09 Jun 2016 09:49:17 -0600
Post by jd1008
Post by Polytropon
[...]
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.
this is the idea. I needed a variable representing something like Home
which is not used by the system itself.

Erich

Loading...