From octave-sources-request at bevo dot che dot wisc dot edu Sun Jun 16 11:45:29 2002 Subject: start octave with initial command From: Paul Kienzle To: octave-sources at bevo dot che dot wisc dot edu Date: Sat, 15 Jun 2002 21:46:36 -0400 I thought this would be an easy problem: start octave with an initial command and continue with the octave prompt. E.g., $ ioctave load test.mat octave> Here is the solution I came up with. I welcome better ones. A better example would be an audio analysis environment which you start with the name of the audio file and it displays the spectrogram for you automatically before the first octave prompt. So instead of $* below you would have: [x,fs]=auload("$1"); spectrogram(x,fs); Paul Kienzle pkienzle at users dot sf dot net ioctave: #! /bin/sh # Start octave with an initial command. # This program is public domain. # Check if the user has a special OCTAVE_INITFILE, or use default .octaverc [ -z "$OCTAVE_INITFILE" ] && OCTAVE_INITFILE=.octaverc # Check if OCTAVE_INITFILE exists. Note that octave first # processes ~/.octaverc then if it is different, ./.octaverc STARTUP="" [ -r $HOME/$OCTAVE_INITFILE ] && STARTUP="source('$HOME/$OCTAVE_INITFILE');" [ -r ./$OCTAVE_INITFILE -a ! ./$OCTAVE_INITFILE -ef $HOME/$OCTAVE_INITFILE ] \ && STARTUP="$STARTUP source('./$OCTAVE_INITFILE');" # Build a script which sources OCTAVE_INITFILE then does our initial command SCRIPT=`mktemp $HOME/octXXXXXX` || exit 1 cat > $SCRIPT <