- From: Edward Elliott <nobody@xxxxxxxxx>
- Date: Mon, 24 Apr 2006 00:56:49 GMT
Brian van den Broek wrote:
if 1; then
Trying (3) gave
brian@Cedric:~$ . .bash_profile
bash: 1: command not found
The error indicates the shell tried to execute a program named '1' and couldn't find one. Arthimetic expressions generally have to be wrapped in (()) in bash:
if ((1)); then
Conditional expressions use [[ ]] (the spaces inside the brackets matter). So ((0)) is false while [[ 0 ]] is true. Yes the difference is screwy and it sucks. Since ((1)) is always true, you could leave out the if line altogether, but I'm guessing that 'stuff' is multiple lines that want to toggle on and off.
Only somewhat, as if I open a brand new shell:
>>> from sys import path
['', '/usr/lib/python24.zip', '/usr/lib/python2.4']
You realize this only prints the first 3 elements of path, right?
So, it seems that I currently have to invoke '. .bash_profile'
manually with each new shell opened for this to have effect.
Your shell must not be opening as a login shell. From the bash man page:
"When bash is invoked as an interactive login shell, or as a
non-interactive shell with the --login option, it first reads and executes
commands from the file /etc/profile, if that file exists. After reading
that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in
that order, and reads and executes commands from the first one that exists
and is readable...
"When an interactive shell that is not a login shell is started, bash
reads and executes commands from /etc/bash.bashrc and ~/.bashrc, if
these files exist."
I don't like differences between my interactive and login shell, so I usually just link .bashrc to .bash_profile. You can do that with this command (from your home dir):
ln .bash_profile .bashrc
(assuming .bashrc doesn't exist, if so remove it first). This makes ..bashrc the same file as .bash_profile, either name accesses the same contents.
Another option is to invoke one from the other with the . command. I.e. put the line '. .bashrc' somewhere in .bash_profile and then move all the common commands (like PYTHONPATH=) to .bashrc.
You shouldn't mess with /etc/profile for personal settings. That's what ..profile/.bashrc are for. /etc is for system-wide settings that apply to all users on the system (including system processes, which you probably don't want to affect).
(Trained by Bill, I even rebooted to be sure that the invocation of
'. .bash_profile' is needed.)
Rebooting is something you almost never need to do in linux unless you're installing new hardware or a new kernel. It won't affect the operation of bash in any way. That said, rebooting won't hurt either if you don't know how to manually restart an affected process or daemon.
I still haven't managed to coerce lines in /etc/profile exporting PYTHONPATH to have an effect.
As I said, must not be a login shell (see above).
I didn't mean to suggest bruno was wrong, but instead that perhaps
ubuntu was a distro falling ... such that the instructions he gave would not work without modification. Apologies if I gave a different
Yes I got that. When you do need ubuntu-specific help, you can try the forums on
I don't think you'll need that for any Python-related questions though (other than installing python packages with apt-get).
- Prev by Date: Re: Passing data attributes as method parameters
- Next by Date: Re: bug in modulus?
- Previous by thread: Re: PYTHONPATH
- Next by thread: Re: PYTHONPATH