Setting PATH in tcsh on Terminal start

Asked by Doug McNutt

Ubuntu 8.04, April 2008
Terminal 2.22.1, terminal emulator for the GNOME desktop

In my .tcshrc file, pretty much copied from OS X, I add $HOME/bin to the PATH provided by Terminal with the line.
setenv PATH $HOME/bin:$PATH
The result shows two copies of $HOME/bin in my PATH.

[~]> echo $PATH
/home/doug/bin:/home/doug/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

The bash/.profile seems to do that by looking for $HOME/bin and adding it if it exists but there seems to be nothing like that for tcsh or csh in /etc/. These lines seem to be the key to what's happening in tcsh.

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

source $HOME/.profile
fails - not surprisingly. Is the terminal app processing .profile anyway?

I can probably test for duplicates but I'd really like to know what's happening. Is Terminal executing bash before it generates a tcsh process? Is there a startup file I can't find? My login shell is specified as tcsh in passwd.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu tcsh Edit question
Assignee:
No assignee Edit question
Solved by:
Doug McNutt
Solved:
Last query:
Last reply:
Revision history for this message
marcobra (Marco Braida) (marcobra) said :
#1

How to upgrade a release via terminal

To check the actual release type:

cat /etc/lsb-release

To be sure your release is fully upgraded

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get clean
sudo apt-get autoremove

and to upgrade the incoming release

sudo do-release-upgrade

Always useful is the online Ubuntu doc https://help.ubuntu.com/8.04/
Hope this helps

Revision history for this message
marcobra (Marco Braida) (marcobra) said :
#2

Sorry wrong answer...

Revision history for this message
Doug McNutt (dmcnutt) said :
#3

This is a freshly installed Ubuntu on a new machine. Everything was selected and installed from a recently downloaded CD-ROM image or using the Add/Remove applications tool.

I did make an attempt to recover from an image of an older Ubuntu home folder from an scp -r image that I made on an OS X box before shutting down an older Ubuntu installation. That might explain the presence of the .profile file from a time when bash was being used by the lady of the house on my login.

Next experiment will be to remove that file but experimentation is never as good as understanding.

Revision history for this message
Doug McNutt (dmcnutt) said :
#4

<https://help.ubuntu.com/community/EnvironmentVariables>
has this to say:

~/.profile - This is probably the best file for placing environment variable assignments in, since it gets executed automatically by the DisplayManager during the startup process desktop session as well as by the login shell when one logs-in from the textual console.

It appears that there is software called "desktop session" which I need to learn about. What has been happening is that, even though my login shell is tcsh, desktop session is somehow executing $HOME/.profile if it exists. It's not clear whether bash is being used to source the file or if desktop session is just accessing it. By the time I get to look any evidence of a bash process is gone.

I created a directory .bashcrap and moved .bash_logout, .bashrc, and .profile into it. Restarting Terminal didn't change anything but logging out of the GUI account did and my .tcshrc script is now working the way I want it to work. I'm pretty sure the three dot files were installed as a part of the Ubuntu standard installation and will not get re-installed as part of a helpful software update. But will they?

What I don't know is if something else is not working right and I just haven't found it. I believe a "session" begins at login to the GUI but I'm not so sure when it ends when switch-user and remote logins are a part of life around here.

So the immediate problem is solved but I'd still like some comments especially about what else I should be reading.