LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-27-2008, 05:31 PM   #1
wstaylor711
LQ Newbie
 
Registered: Oct 2008
Posts: 3

Rep: Reputation: 0
NASA Newbie - /bin/tcsh User ported to Linux - How to set PATH


Greetings,

We've just been herded off SGI Main Frames to Altix/Linux. This user has favored /bin/tcsh and would like to stay with it in Linux. Question: How is the PATH variable set? UNIX is, of course, .login .cshrc, etc.. I haven't got a clue how to append to the default PATH. Any takers?
 
Old 10-27-2008, 05:56 PM   #2
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Rep: Reputation: 51
Quote:
Originally Posted by wstaylor711 View Post
Greetings,

We've just been herded off SGI Main Frames to Altix/Linux. This user has favored /bin/tcsh and would like to stay with it in Linux. Question: How is the PATH variable set? UNIX is, of course, .login .cshrc, etc.. I haven't got a clue how to append to the default PATH. Any takers?
If you want per-user control, just put a .tcshrc in the user's home dir.

edited to add:
and in tcshrc, to add to the path, you do something like:
Code:
setenv PATH ${PATH}:/other/path:/one/more:${HOME}/bin
note the lack of '=' like in a bash export.

Last edited by BrianK; 10-27-2008 at 05:59 PM.
 
Old 10-27-2008, 05:58 PM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Welcome to LQ!!

Where in NASA?? (I'm at an obscure quasi-center in Pasadena...)

The PATH variable is set/modified in one or more of the init scripts---which one(s) depends on the distribution. I'm not sure how it is affected by your choice of shell.

In BASH at least, you append to the PATH thusly:

export PATH=$PATH:/etc/X11

(In this example, I added /etc/X11 to my PATH)
 
Old 10-27-2008, 06:18 PM   #4
wstaylor711
LQ Newbie
 
Registered: Oct 2008
Posts: 3

Original Poster
Rep: Reputation: 0
Many Thanks to BrianK and pixellany for good info on how to append to the PATH environment variable. BrianK's advice hit the head spot on and pixellany's references were much appreciated.

wstaylor711
(MSFC/EV31)
 
Old 10-27-2008, 06:41 PM   #5
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
The info here from pixellany is a bit inaccurate.

The init files for the shell depends only on the shell, and not the distro. Bash reads a number of files, tcsh reads others. The man page for either of them will tell you the files that are involved. I don't think that unix vs. linux is a factor here at all, unless I misunderstood something.
 
Old 10-28-2008, 06:18 AM   #6
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Quote:
Originally Posted by i92guboj View Post
The info here from pixellany is a bit inaccurate.

The init files for the shell depends only on the shell, and not the distro. Bash reads a number of files, tcsh reads others. The man page for either of them will tell you the files that are involved. I don't think that unix vs. linux is a factor here at all, unless I misunderstood something.
Most distros I have used default to BASH, and there are still big differences in the init process. I don't doubt that the choice of shell introduces even more differences.
 
Old 10-28-2008, 11:25 AM   #7
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
Quote:
Originally Posted by pixellany View Post
Most distros I have used default to BASH, and there are still big differences in the init process. I don't doubt that the choice of shell introduces even more differences.
Well, there are two separate issues here.

Most init systems depends on bash (or any other shell) to do some tasks. That means that some of the init scripts will be shell code, so yes: in that sense, some of the scripts that will be sourced at startup depends on the distro.

But my point was that these are not shell initialization files. That they are bash code is a mere coincidence, and a design decision of the people who designed the init system of that distro.

The bash initialization files are very well documented on the bash man pages, and having one or another distro doesn't change that (unless the distro maintainer patches bash, of course). They are always the same files, and they are always read on the same very order, and depending on whether the shell is or not a login shell one or another file is used. It's all in the man page, "INVOCATION" section.

And I guess that the same is true for tcsh, ksh or whatever shell.

Out of curiosity, I googled for the tcsh man page and on a first sight you can see a section called "Startup and shutdown", there you can see:

Quote:
A login shell begins by executing commands from the system files /etc/csh.cshrc and /etc/csh.login. It then executes commands from files in the user's home directory: first ~/.tcshrc (+) or, if ~/.tcshrc is not found, ~/.cshrc, then ~/.history (or the value of the histfile shell variable), then ~/.login, and finally ~/.cshdirs (or the value of the dirsfile shell variable) (+). The shell may read /etc/csh.login before instead of after /etc/csh.cshrc, and ~/.login before instead of after ~/.tcshrc or ~/.cshrc and ~/.history, if so compiled; see the version shell variable. (+)

Non-login shells read only /etc/csh.cshrc and ~/.tcshrc or ~/.cshrc on startup.
As you see, it's something only relevant to tcsh, a distro-agnostic thing. And it will work the same on solaris or bsd by that matter as long as tcsh compiles and is usable under them.
 
Old 10-30-2008, 03:05 PM   #8
wstaylor711
LQ Newbie
 
Registered: Oct 2008
Posts: 3

Original Poster
Rep: Reputation: 0
Many thanks pixellany and i92juboj for further responses to my initial query. I have been able to append the the system set PATH variable based on BrianK's input and have reviewed these recent additions with further interest. What a forum! You guys are great! I am pleased to have my understanding challenged and my noggin expanded.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Set the path systemwide/Set the path for a user with Slackware jayhel Slackware 1 06-12-2005 01:24 AM
How to set tcsh prompt: # for root and % for user? robson Linux - Newbie 1 10-12-2003 04:13 PM
Newbie needs help Installing j2sdk-1_4_2-nb_3_5_1-bin-linux.bin bendoku Linux - Newbie 5 10-11-2003 10:27 AM
How to set path permanently for a particular user Sifvion Slackware 14 10-16-2002 12:02 PM
I have installed j2sdk-1_4_0-linux-i386-rpm.bin.pls tell me how to set the path Harish_f Linux - General 2 05-06-2002 07:13 AM


All times are GMT -5. The time now is 10:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration