The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM
Home Forums Register Rules & FAQ Members List Arcade Search Today's Posts Mark Forums Read


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!


Other UNIX.COM Threads You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" Lokesha UNIX for Dummies Questions & Answers 4 12-19-2007 09:52 PM
Same ol "no acceptable cc found in $PATH" but I'm not clueless... just still a noob SloYerRoll UNIX for Dummies Questions & Answers 4 10-22-2007 07:20 AM
Network Path Not Found Error "Sunfire V100" louisd11 SUN Solaris 4 12-13-2006 09:20 AM
Why is it Bad Idea to insert "." (Dot) to PATH ? amitbern UNIX for Dummies Questions & Answers 2 11-07-2005 08:12 AM
Adding "Private" to path name roadrunnerray UNIX for Dummies Questions & Answers 5 10-15-2004 07:33 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-21-2006
Registered User
 

Join Date: May 2006
Location: Hamburg, Germany
Posts: 8
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Unhappy How to add a variable to the "path"

Hello,

I am new to this board and I have several questions:

For two days now I've been trying to add a variable to my "path" -- without any success. What I want to do is add the path for my MySQL database to my "path" so I can access it from anywhere. Why is this such a hard thing to do in UNIX? Everybody recommends something else. WHERE do I have to add the path. Is the file called ".bash-profile" or ".cshrs" or ".shrs" or ".profile" or what? And, if you can give me an ultimate answer to my question, where exactly is this file located on the system?

I have been a computer science student at uni for 3 years now, but nothing has ever caused me so much trouble. Such an easy task, but so hard to do, so many possible combinations!! Why??

Can anybody tell me how to do it?
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 05-21-2006
jsandova's Avatar
Registered User
 

Join Date: May 2006
Location: Burbank Ca
Posts: 20
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Well if you are using a sh/bash/ksh shell then do the following:
cd <enter>

ls -lrta <enter>

vi .profile

Look for the following line and add the path you want after the :
PATH=$PATH:$HOME/bin:/var/juno/bin:/usr/sbin/ifconfig:

After you save and exit out of your .profile then do the following so you changes can take effect:

source .profile <enter>
Reply With Quote
  #3 (permalink)  
Old 05-21-2006
Registered User
 

Join Date: May 2006
Posts: 8
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
or use
export PATH=$PATH:<your additions seperated with colons>:

on command line and will be valid for the session only
Reply With Quote
  #4 (permalink)  
Old 05-22-2006
tayyabq8's Avatar
Registered User
 

Join Date: Nov 2004
Location: Kuwait
Posts: 510
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
About UNIX shell differences and overview pls read THIS And about .profile, .login files, these files are located in user's home directory, which is most probably /home/username, list the contents of user's home directry with ls -a and you can see these files there. And which file to modify, its very simple not so complex, check the login shell of user with command:
Code:
cat /etc/passwd | grep username
admin:x:101:1:Tayyab:/home/username:/usr/bin/ksh
Last field tells you the login shell of the user, in case of ksh, bash or sh you have to modify .profile to set the path and in case of csh it is .login.

Hope it helps!

Best Regards,
Tayyab

Last edited by tayyabq8 : 05-22-2006 at 03:50 AM.
Reply With Quote
  #5 (permalink)  
Old 05-22-2006
Registered User
 

Join Date: May 2006
Location: Hamburg, Germany
Posts: 8
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Quote:
Originally Posted by jsandova
Well if you are using a sh/bash/ksh shell then do the following:
cd <enter>

ls -lrta <enter>

vi .profile

Look for the following line and add the path you want after the :
PATH=$PATH:$HOME/bin:/var/juno/bin:/usr/sbin/ifconfig:

After you save and exit out of your .profile then do the following so you changes can take effect:

source .profile <enter>
OK, thanks. I did what you said, but still MySQL can't be found. My .profile now looks exactly like this:

PATH=$PATH:$HOME/usr/local/

But when I type "which mysql" <enter>

I still get this:

no mysql in /bin /sbin /usr/bin /usr/sbin /usr/local/bin /Users/timo/usr/local/ /usr/local/bin

Can it be that there are different files setting my path? I can't really see a connection between the path I set and the error message I get.
Reply With Quote
Google UNIX.COM
Reply



Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7. The time now is 11:35 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger

Search Engine Optimization by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102