LinuxAnswers - the LQ Linux tutorial section.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 09-19-2004, 12:18 PM   #1
LQ Newbie
Registered: Jul 2004
Posts: 24

Rep: Reputation: 15
setting bash to look in current directory before searching the path

why doesn't bash look first in the current directory for an executable 'foo' but searches the path and returns an error when the current directory is not listed?

how can I change that?
Old 09-19-2004, 12:23 PM   #2
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 65
Just add the current directory to your path:
Old 09-19-2004, 04:34 PM   #3
LQ Newbie
Registered: Jul 2004
Posts: 24

Original Poster
Rep: Reputation: 15
hm... ok that'll do it. thanks

Last edited by muhkuhmasta; 09-19-2004 at 04:35 PM.
Old 09-21-2004, 03:04 AM   #4
LQ Newbie
Registered: Jul 2004
Posts: 24

Original Poster
Rep: Reputation: 15
but what do I need to do in order to tell bash to remember my settings?
Old 09-21-2004, 03:08 AM   #5
Senior Member
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,265

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Add them to the bash startup scripts, ~/.bash_profile for login shells and ~/.bashrc for non-login shells (what I do is just have my .bash_profile source .bashrc so I don't need to duplicate stuff).


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
cd keeps snapping back to current directory when called from bash script ghrellin Linux - General 5 08-28-2005 01:50 PM
How to rsynce the actual directory path instead of just the directory at the end of Niceman2005 Linux - General 5 04-08-2005 08:58 PM
edit path environment variable to include current working directory alb1954 Linux - Newbie 8 07-12-2004 12:26 AM
How to change the path of the current directory ? ndha Linux - General 7 12-03-2003 12:05 PM
BASH: How to get current workin directory? gmitra Programming 9 09-20-2003 11:30 PM

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

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