Henry F. Mollet wrote:
Thomas explained this to be before. I believe it has nothing to do with
octave (see below)
Henry
[~] -bash-2.05b 502$ ls
Adobe_SVG_3.0 _nstaller_Log Sites
CMakeTmp Sites_extra
cut
[~] -bash-2.05b 503$ exec ls
Adobe_SVG_3.0 _nstaller_Log Sites
CMakeTmp Sites_extra
cut
[Process completed]
% Now I have to open a new shell
If I understand Moc's problem correctly, I don't think it's "exec"'s behavior that he's having problem with. The problem is every time he launches Terminal, octave is being run, instead of his usual shell (be it /bin/sh or /bin/bash).
My first rather wacky guess would be ... Moc, are you sure your shell isn't "/usr/bin/octave" or something like that? :)
Here's a rather contrived example on Debian: I created a "test" user with "shell" of /usr/bin/octave, and when I try to open a shell as that user ...
===
plato:~# grep test /etc/passwd
test:x:1001:1001:Tester:/home/test:/usr/bin/octave
plato:~# su - test
su: Authentication service cannot retrieve authentication info.
(Ignored)
GNU Octave, version 2.1.73 (i486-pc-linux-gnu).
Copyright (C) 2006 John W. Eaton.
This is free software; see the source code for copying conditions.
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTIBILITY or
FITNESS FOR A PARTICULAR PURPOSE. For details, type `warranty'.
Additional information about Octave is available at
http://www.octave.org.
Please contribute if you find this software useful.
For more information, visit
http://www.octave.org/help-wanted.htmlReport bugs to <bug@octave.org> (but first, please read
http://www.octave.org/bugs.html to learn how to write a helpful report).
-su:1>
===
The only thing I couldn't reproduce is the "exec octave" line, as I get:
===
-su:2> system("ps aux | grep octave")
test 28817 0.0 0.1 4992 1380 pts/15 S+ 00:17 0:00 sh -c ps aux | grep octave
test 28819 0.0 0.0 3712 708 pts/15 R+ 00:17 0:00 grep octave
ans = 0
-su:3>
===
It's actually a mystery to me why I don't see any octave proper running there.
I don't know for sure what additional rc scripts are run in OS X, but you might want to check system files like /etc/profile and /etc/bashrc, etc, etc. You should check any files that your own .bashrc or .bash_profile or .profile, or .login is sourcing.
And, if you are really interested in finding which process is launching that octave, you might try "ps afu" instead. I have to admit I don't know all the switches to ps, but at least in GNU's version of ps (in BSD compatible mode, I think), "f" seems to bring up a tree view that shows the child-parent relationship between processes. If this doesn't work, you can ... well, look at "man ps" on your system to see what option will let you see PPID (parent process ID).
And until you find a real solution, this bandage that I found might work for you too :)
===
-su:13> system("exec bash")
test@plato:~$
===
Regards,
Andrew