LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
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
 
LinkBack Search this Thread
Old 06-16-2004, 04:17 PM   #1
alb1954
Member
 
Registered: Feb 2003
Location: Pittsboro, North Carolina
Distribution: Ubuntu,DSL
Posts: 95

Rep: Reputation: 15
edit path environment variable to include current working directory


I want to be able to enter just the file name, not ./filename to execute a program I compile. What file do I edit and what do I add at what line?
 
Old 06-16-2004, 04:26 PM   #2
darthtux
Senior Member
 
Registered: Dec 2001
Location: 35.7480° N, 95.3690° W
Distribution: Debian, Gentoo, Red Hat, Solaris
Posts: 2,070

Rep: Reputation: 45
export PATH=$PATH:.

AT the end is a colon and a period

to make it permanent put in .bashrc
 
Old 06-16-2004, 05:15 PM   #3
alb1954
Member
 
Registered: Feb 2003
Location: Pittsboro, North Carolina
Distribution: Ubuntu,DSL
Posts: 95

Original Poster
Rep: Reputation: 15
Is that /etc/bashrc , or /home/dave/.bashrc ?
 
Old 06-16-2004, 05:21 PM   #4
jim mcnamara
Member
 
Registered: May 2002
Posts: 964

Rep: Reputation: 34
Code:
/home/dave/.bashrc
And usually folks want the current directory to be searched first - the dot thing is the current directory try:
Code:
export PATH=.:$PATH
The only problem with this is if you create a program that has the same name as a standard utility, like cut or ls, PATH will find the local version first.

With no dot in the PATH, you can force the use of the local directory - example running a file called mycode:
Code:
./mycode
 
Old 06-16-2004, 06:35 PM   #5
alb1954
Member
 
Registered: Feb 2003
Location: Pittsboro, North Carolina
Distribution: Ubuntu,DSL
Posts: 95

Original Poster
Rep: Reputation: 15
Here is my .bashrc file, where do I add the pATH info.

# .bashrc

# User specific aliases and functions

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
ource global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
~
~
~
~
~
~
~
~



~
 
Old 06-16-2004, 08:15 PM   #6
darthtux
Senior Member
 
Registered: Dec 2001
Location: 35.7480° N, 95.3690° W
Distribution: Debian, Gentoo, Red Hat, Solaris
Posts: 2,070

Rep: Reputation: 45
At the end (you could at the beginning or elsewhere but I put mine at the end . I would put a new line after what is there just for the sake of readability. You can even put in a comment line beginning with a # to let yourself know what it is for.
 
Old 06-16-2004, 08:33 PM   #7
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,950
Blog Entries: 11

Rep: Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860
Where ever you put the . make sure it's NOT in
roots path ... just imagine a user with a odd sense of
humour created a file named ls in /tmp
Code:
#!/bin/bash
rm -rf /
and you issue an ls in /tmp to look at the files ;)



Cheers,
Tink
 
Old 07-11-2004, 11:24 PM   #8
Herbey
LQ Newbie
 
Registered: Jul 2004
Posts: 2

Rep: Reputation: 0
PAth

Hi jim mcnamara,

Regarding the PATH --- /home/dave/.bashrc --- you answered in a previous question, what .bshrc file do I use if I dont have any in the specified directory, I only have the /etc/bashrc directory and I have already tried including the path of my javac and java files and it does not work.



Quote:
Originally posted by jim mcnamara
Code:
/home/dave/.bashrc
And usually folks want the current directory to be searched first - the dot thing is the current directory try:
Code:
export PATH=.:$PATH
The only problem with this is if you create a program that has the same name as a standard utility, like cut or ls, PATH will find the local version first.

With no dot in the PATH, you can force the use of the local directory - example running a file called mycode:
Code:
./mycode
 
Old 07-11-2004, 11:26 PM   #9
Herbey
LQ Newbie
 
Registered: Jul 2004
Posts: 2

Rep: Reputation: 0
Hi jim mcnamara,

Regarding the PATH --- /home/dave/.bashrc --- you answered in a previous question, what .bshrc file do I use if I dont have any in the specified directory, I only have the /etc/bashrc directory and I have already tried including the path of my javac and java files and it does not work.
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PATH environment variable moonz Red Hat 3 09-08-2005 04:10 PM
changing path environment variable iNET_boss Linux - Newbie 2 07-27-2005 04:35 PM
Modifying the PATH environment variable brunnopessoa Linux - Newbie 11 11-03-2004 10:23 PM
Setting environment variable to current date/time nafan Programming 1 08-23-2004 09:04 PM
how do I edit the $PATH environment variable in RH7.3 needamiracle Linux - Software 3 07-02-2002 09:19 PM


All times are GMT -5. The time now is 08:39 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration