# Newbie .profile and /etc/profile question



## aaronbsdf (Sep 9, 2014)

I am new to Unix, and I am trying to declare a variable. I edit /etc/profile to read:


```
VARIABLE=Variable
export VARIABLE
```

Saved, exit. I did the same thing to a standard user account in the .profile. When I run `echo $VARIABLE` I get noting but a blank line as root. Strangely, the user account can successfully echo the variable, but ONLY when SSH'd into the system. 

My question is why when I declare a variable in a .profile or in /etc/profile, it never works unless SSH'd into localhost?

TIA


----------



## kpa (Sep 9, 2014)

The files /etc/profile and ~/.profile are only read by bourne shells like /bin/sh. The root's shell defaults to csh(1) that uses a different set of initialization files with different syntax, /etc/csh.cshrc and ~/.cshrc (there are couple more depending on if the shell is a login shell or not, consult the man page).


----------



## aaronbsdf (Sep 9, 2014)

Thanks @kpa. So I take it when I `ssh` into localhost I am using the Bourne shell as a standard user account, but when I log into a terminal I am using csh which is why declaring the variable has a null result. Makes sense.

The weird thing is I do the same thing in Debian and get the same result. Pretty sure I am using bash there, but I'll check it.


----------



## aaronbsdf (Sep 9, 2014)

Actually that can't be the problem. As a standard user I echo a variable it fails. Then I SSH into localhost as the same user and the variable works! 


```
echo $SHELL 
/bin/sh
```

Same shell.
Hmmmm... Weird.


----------

