LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 07-10-2007, 11:01 PM   #1
tejpatil
Member
 
Registered: Feb 2004
Posts: 43

Rep: Reputation: 15
unable to setup PATH


Hi,

I am trying to setup the path whereever I go to command prompt. Below is the PATH,

Initially when I go to command prompt and type the following command

echo $PATH I get this ==> /usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin

I need this Path to be set ==>/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:
/usr/kerberos/bin:/usr/lib/ccache:/usr/local/bin:/usr/bin:/bin:
/usr/X11R6/bin:/home/db2admin/sqllib/bin:/home/db2admin/sqllib/adm:
/home/db2admin/sqllib/misc


Since I have installed KSH on my fedora which have default bash shell, I was not able to find the ksh profile file to add this as a path. So I wrote a small setev file to set this path, below is the setev file contents

===============================================
$more setev

PATH=$PATH:/usr/kerberos/bin:/usr/lib/ccache:/usr/local/bin:/usr/bin:/bin:/usr/X11
R6/bin:/home/db2admin/sqllib/bin:/home/db2admin/sqllib/adm:/home/db2admin/sqllib/m
isc

echo $PATH
================================================

If I execute this setev once I go to command prompt this script gets executed, but path still remains as
/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin.

I have to manually go and do the following to set path for command prompt,

PATH=$PATH:/usr/kerberos/bin:/usr/lib/ccache:/usr/local/bin:/usr/bin:/bin:/usr/X11
R6/bin:/home/db2admin/sqllib/bin:/home/db2admin/sqllib/adm:/home/db2admin/sqllib/m
isc.

I have fedora 7.

Thanks for all your help.

Tej
 
Old 07-10-2007, 11:34 PM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
Scanning though the ksh manpage, I see that the ~/.profile is sourced. Also for interactive shells, check the contents of the file indicated by $ENV. I doubt that it would undo .profile changes, however.
 
Old 07-11-2007, 02:51 AM   #3
galrub
Member
 
Registered: Sep 2006
Posts: 41

Rep: Reputation: 15
(sort of a newbbe)
Had a problem like this and, there is a file in /etc
called profile.

under the "# Path manipulation" section change the lines to whatever you need.

it worked for me.

good luck.
 
Old 07-11-2007, 07:23 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,258

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
As per jschiwal, look for the hidden file .profile in your home.
If it's there, edit as needed, if not create it and add your cmds.
Remember to explicitly export the PATH var.
 
Old 07-11-2007, 08:59 PM   #5
tejpatil
Member
 
Registered: Feb 2004
Posts: 43

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by chrism01
As per jschiwal, look for the hidden file .profile in your home.
If it's there, edit as needed, if not create it and add your cmds.
Remember to explicitly export the PATH var.

=========================================================================
I know how to setup the path by doing the export. But my question is

Can anybody please give me an example of a script which I can use to setup the path everytime when I go to linux prompt. So that I just execute the script and path is setup as I want.

Thanks,
Tej
 
Old 07-12-2007, 02:05 AM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,258

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
The point is that if you set up the cmds as detailed (inc export) above in the .profile file (for ksh), it will automatically set it up for you every time you login.
If you want to manually run it, just create a new shell file eg

path_set.sh
chmod u+x path_set.sh

then to run

. ./path_set.sh

notice that's
<dot><space>./path_set.sh
which will inc it in your current env.
It'll still need export cmd so subshells see it.
 
  


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
Unable to Setup LVM for HTPC jroggow Slackware 0 05-21-2007 10:06 PM
Unable to mount path from SAN sunhui Linux - Software 1 02-28-2007 10:15 AM
Unable to locate 'cc' utility in path SEATU Linux - Newbie 2 10-05-2005 01:22 AM
Unable to find 'cc' in your PATH, how do I add it? brokenpromises Fedora 5 03-22-2005 01:35 AM
How to setup path in Redhat7.1 jane207 Linux - Software 5 11-06-2001 06:59 PM


All times are GMT -5. The time now is 01:57 AM.

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