LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.

Notices


Reply
  Search this Thread
Old 11-17-2006, 08:14 PM   #1
linuxmsg
LQ Newbie
 
Registered: Nov 2006
Location: india
Distribution: Red Hat,Solaris
Posts: 3

Rep: Reputation: 0
Post just saying - hi [ how to set path in solaris permanently ]


hi all,

this is arvind from india.

I have a question regarding solaris.

# how to set or export path on permanent basis ?
I know PATH=.. and export PATH but it works temporaray,once you restart or logout,you will get old path or by default.
So i need help.Actually i want to set path for perl in solaris 10.
thanks
Arvind
 
Old 11-18-2006, 03:57 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981
well that's *not* just saying hi.. that's asking a solaris question. so moved to SOlaris forum.
 
Old 11-18-2006, 07:12 AM   #3
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062
You have two choices - system-wide or user.

System-wide; i.e., so every user logging on to the system gets the PATH, add a line in /etc/profile like this:
Code:
PATH=${PATH}:/path-to-application-executable
You may also have to add a line in /etc/profile
Code:
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/path-to-application-libraries
Alternatively, do the same in the .profile file in your home directory; note, however, that you must log out and log back in again for any change to take effect (/etc/profile and your home directory .profile are read once when you login).

You can add multiple lines as shown in /etc/profile or ~/.profile.

If you're using C-Shell, you would put the .profile entry in .login (using C-Shell syntax).
 
Old 11-18-2006, 12:41 PM   #4
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Ubuntu/WSL
Posts: 9,781

Rep: Reputation: 481Reputation: 481Reputation: 481Reputation: 481Reputation: 481
Additionaly, you can set the initial users and root PATH in /etc/default/login and /etc/default/su (PATH & SUPATH).
 
Old 11-18-2006, 11:41 PM   #5
linuxmsg
LQ Newbie
 
Registered: Nov 2006
Location: india
Distribution: Red Hat,Solaris
Posts: 3

Original Poster
Rep: Reputation: 0
thank.. i will try it and let you know.

regards

arvind
 
Old 03-21-2008, 02:29 AM   #6
madivad
Member
 
Registered: Jan 2007
Posts: 70

Rep: Reputation: 15
*** DIGGING UP AN OLD POST to a NEW QUESTION ***

I have been looking for where the best place to add to the PATH environment and saw that while editing /etc/X11/gdm/PreSession/DEFAULT there is an alteration to PATH there. I edited it, logged out and back in again, but that didn't do it.

Then I went searching and found this post. I tried tronayne's answer, but that didn't work either (/etc/profile).

I don't have a .profile on the system anywhere.

I don't want to create a new entry, I just want to edit what is already there.

Additionally, my path is not set in either of the locations that jlliagre has indicated (the lines are commented out).

Where can I find where PATH is set?

edit: I have actually gone and created the .profile file in my home directory (it wasn't there - no, it wasn't hidden, it's just not there in ls -al) and added the lines:
Code:
dave@solaris:~# cat .profile
PATH=$PATH:/usr/local/bin:/usr/ccs/bin:/usr/sfw/bin
export PATH
dave@solaris:~#
Still not working

Last edited by madivad; 03-21-2008 at 02:57 AM.
 
Old 03-21-2008, 03:54 AM   #7
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Ubuntu/WSL
Posts: 9,781

Rep: Reputation: 481Reputation: 481Reputation: 481Reputation: 481Reputation: 481
Quote:
Originally Posted by madivad View Post
Additionally, my path is not set in either of the locations that jlliagre has indicated (the lines are commented out).
Did you try uncommenting and customizing them ?
 
Old 03-21-2008, 04:13 AM   #8
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981
madivad, Do NOT dig up old thread for new questions, that's *EXACTLY* what you shouldn't do, in it's most refined and purest form... new question = new thread.
 
Old 03-21-2008, 04:48 AM   #9
madivad
Member
 
Registered: Jan 2007
Posts: 70

Rep: Reputation: 15
Quote:
Originally Posted by acid_kewpie View Post
madivad, Do NOT dig up old thread for new questions, that's *EXACTLY* what you shouldn't do, in it's most refined and purest form... new question = new thread.
My appologies. I wasn't thinking too straight. It SHOULD have read "Digging up an old thread - SAME question" as it is in fact the SAME question.

Should that still be a new thread? I was also trying to show that I had searched forums before posting, but your comment has been taken on board
 
Old 03-21-2008, 06:46 AM   #10
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062
OK, once more into the breech: in /etc/profile or ${HOME}/.profile, define an environment variable; e.g., EDITOR=/usr/bin/vi, then export that variable into the environment; i.e., export EDITOR.

Adding on to a previously-defined environment variable: PATH=${PATH}:/usr/local/bin and so on.

Use a previously-defined environment variable: e.g., MYSQLDIR, PATH=${PATH}:${MYSQLDIR}/bin.

If you make any changes in /etc/profile, you must log out and log back in for them to take effect; similarly, if you make changes in your home directory .profile, you ought to log out and log back in for them to take effect.

Oh, yeah, try reading man profile too.

Are you using C-shell, by any chance? If you are, then a ${HOME}/.profile will do nothing. C-shell (if so, you have my sympathy by the way) does these same things in /etc/profile for every user then in ${HOME}/.login and ${HOME}/.cshrc.

To set the path environment variable in ${HOME}/.login, you use something like this
Code:
set path = ( $path /usr/local/bin )
That's the extent of my C-shell knowledge and setting environment variables for it; try man csh if that's the case.
 
Old 03-21-2008, 08:33 AM   #11
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Ubuntu/WSL
Posts: 9,781

Rep: Reputation: 481Reputation: 481Reputation: 481Reputation: 481Reputation: 481
Madivad, did you test my previous suggestion ?
http://www.linuxquestions.org/questi...34#post3095734
 
Old 03-21-2008, 11:07 AM   #12
czezz
Member
 
Registered: Nov 2004
Distribution: Slackware/Solaris
Posts: 839

Rep: Reputation: 40
Make sure that user who is going to use .profile is using /bin/sh SHELL.
To verify that check /etc/passwd.
 
Old 03-21-2008, 11:52 AM   #13
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Ubuntu/WSL
Posts: 9,781

Rep: Reputation: 481Reputation: 481Reputation: 481Reputation: 481Reputation: 481
Please don't advise using /bin/sh which is a pain under Solaris. Suggest using /bin/ksh or /bin/bash instead. They use .profile the same way.

/etc/default/login PATH variable is the place to set the initial PATH regardless of what shell is used.
 
Old 03-21-2008, 02:40 PM   #14
madivad
Member
 
Registered: Jan 2007
Posts: 70

Rep: Reputation: 15
I have tried everyones suggestions so far and it's becoming an awful mess. So far, nothing is working and I thought I would recap.

I am using OpenSolaris and it's the fancy gnome desktop, not the CDE of Solaris (if this makes a difference)

I have tried uncommenting where PATH has been previously commented out

I have created .login and .profile files in my home dir

I have edited /etc/default/login

After EVERY edit I always log out and back in again and this is ALWAYS the result:
Code:
dave@solaris:~$ set | grep PATH
MANPATH=/usr/gnu/share/man:/usr/share/man:/usr/X11/share/man
PATH=/usr/gnu/bin:/usr/bin:/usr/X11/bin:/usr/sbin:/sbin

dave@solaris:~# set | grep PATH
MANPATH=/usr/gnu/share/man:/usr/share/man:/usr/X11/share/man
PATH=/usr/gnu/bin:/usr/bin:/usr/X11/bin:/usr/sbin:/sbin
To test I am doing the above in a terminal window

edit: I have come to the conclusion that at some final stage PATH is being set somewhere without inheriting the existing path. But I am at my wits end trying to find where this is happening

Last edited by madivad; 03-21-2008 at 03:46 PM.
 
Old 03-21-2008, 06:17 PM   #15
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Ubuntu/WSL
Posts: 9,781

Rep: Reputation: 481Reputation: 481Reputation: 481Reputation: 481Reputation: 481
Quote:
Originally Posted by madivad View Post
I am using OpenSolaris and it's the fancy gnome desktop, not the CDE of Solaris (if this makes a difference)
Can you post the content of /etc/release to clarify ?
Quote:
edit: I have come to the conclusion that at some final stage PATH is being set somewhere without inheriting the existing path. But I am at my wits end trying to find where this is happening
Did you look at the bash files ?
~/.bashrc
/etc/bash.bashrc
 
  


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 12:24 AM
edit value of PATH permanently rsumbeling Linux - General 2 12-13-2004 10:57 AM
permanently adding to the path hyphenage Linux - General 12 07-16-2003 01:14 AM
How to set path permanently for a particular user Sifvion Slackware 14 10-16-2002 11:02 AM
How to set PATH permanently chandhru Linux - Newbie 3 09-24-2002 12:43 AM

LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris

All times are GMT -5. The time now is 04:58 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
Open Source Consulting | Domain Registration