LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-24-2012, 08:33 AM   #1
chiendarret
Member
 
Registered: Mar 2007
Posts: 307

Rep: Reputation: 16
Bash and path issue


Attempted running of "filename.py", having "#!/usr/bin/env python" as first line, by commanding "filename" from inside a subfolder of /usr/local failed with error

bash: filename.py: command not found.

I had to command either "python filename.py" or "./filename.py" in order that the python program executes.

Question: how to fix "bash" in order that the directory from where the command was issued is on my path?

thanks, chiendarret
 
Old 01-24-2012, 08:51 AM   #2
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,281

Rep: Reputation: 320Reputation: 320Reputation: 320Reputation: 320
Create this file in folder where by standard system searches for execute, so: "/usr/local/bin" or "$HOME/bin" if this is added to your PATH. Eventually add this directory to PATH environment variable. For example
Quote:
export PATH=$PATH:/additional/path
But the first method is preferred.
 
Old 01-24-2012, 09:31 AM   #3
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
Your shell will only execute commands that have a clear absolute or relative path prefixing them, or are in a directory defined by your $PATH variable.

Permanent modifications of PATH are done in your shell start-up scripts. See the INVOCATION section of the bash man page for a description of which files it loads when starting on your system.
 
Old 01-25-2012, 01:13 AM   #4
chiendarret
Member
 
Registered: Mar 2007
Posts: 307

Original Poster
Rep: Reputation: 16
Thanks
 
  


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
[SOLVED] Command path is in PATH but bash does not find the command. stf92 Linux - Newbie 17 03-23-2012 04:19 AM
PATH for Bash Gecopa Linux - General 7 06-23-2009 11:21 AM
bash script path issue - how to pass a path as a string to a variable PiNPOiNT Programming 5 04-17-2009 05:48 PM
search path ($PATH) weird issue bricedebrignaisplage Linux - General 3 04-25-2007 04:41 AM
Path issue in Bash gd2shoe Linux - Software 2 08-28-2005 10:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:01 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