[Tutor] i can't for the life of me get "#! /usr/bin/env python" or "#!/usr/bin/python" to work
stuart at sjsears.com
Fri Oct 23 10:32:22 CEST 2009
On 21/10/09 23:12, Luke Paireepinart wrote:
> On Wed, Oct 21, 2009 at 4:56 PM, Jason Willis
> <chaoticslacker at gmail.com>wrote:
>> so i changed the .bashrc and added at the end :
>> PATH="/home/compy/pythons:$PATH" ###which is the actual path to my
>> python proggies###
That should work, but you'll have to tell the shell to re-read the file.
technically you should put this stuff in ~/.bash_profile, log out and
log in again. Otherwise you rick repeatedly redefining PATH and adding
the same directory to it over and over again. Which is relatively
harmless but can be annoying.
you should also export the PATH variable so that it is passed to
subshells (many shell commands run in a subshell)
the 'correct' command in your bash startup files would be
the new dir should really go on the end of the path in case you
inadvertently create a script with the same name as a system command.
> No, you have to set the environment variable from within the path,
> not modifying .bashrc. $PATH refers to your current path.
no, it doesn't. I think you misunderstand.
$PATH is the search path used by the shell when looking for executable
commands. it is not your current working directory. That's $PWD
> If you're in, say /temp/mystuff , and you set the environment
> variable from there, then it will set
> PATH="/home/compy/pythons;/temp/mystuff" but if you edit the file
> directly it can't retrieve the value of $PATH (an envrionment
> varaible) so it actually adds the value "$PATH" to your path, which
> probably doesn't exist unless you mkdir $PATH and put your files in
> it and run it that way.
no. it will resolve $PATH first and then run the command.
you can see what PATH currently contains by typing
so, if for example echo $PATH prints
is interpreted as
Stuart Sears RHCA etc.
"It's today!" said Piglet.
"My favourite day," said Pooh.
More information about the Tutor