On Thu, 2005-03-03 at 10:44, John W. Eaton wrote:
On 3-Mar-2005, E. Joshua Rigler <address@hidden> wrote:
| I want to be able to run a script from the OS command line, but stay
| inside the interpreter after the script finishes executing. In other
| words, if I type:
|
| Unix Shell> octave script.m
|
| ...I do NOT want Octave to exit upon completion of script.m.
If you convert your script to a function that takes no arguments, you
can use
octave --funcall FUNC
jwe
This option does what I *said* I wanted, but it is not what I actually
need ;^). If I use --funcall, I have to find some way to pass any
variables I might set in FUNC back to the interpreter. I can think of
no good way to do this.
The motivation is to set up a temporary and limited-scope data analysis
environment that is part of a bigger "suite" that includes OpenDX and
associated modules, among a variety of other scripts and open-source
tools. This environment should exist completely independent of the
user's default Octave environment (if they have one). The following
script is a kludge that works on UNIX systems, but aside from being
less-than-portable, the user's ~/.octaverc file continues to be read:
#!/bin/sh
STARTDIR=$PWD
echo "STARTDIR='$PWD' ; cd(STARTDIR) ; clear STARTDIR " > /tmp/.octrc_end
cat $1 /tmp/.octrc_end > /tmp/.octaverc
cd /tmp
octave --silent
rm /tmp/.octaverc*
cd $STARTDIR
unset STARTDIR
-EJR