Launch octave

From Octave
Jump to: navigation, search

An m-file function used in support of creating a MacOS X App bundle.

#!/bin/sh
# Copyright (C) 2012, Ben Abbott
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; If not, see <http://www.gnu.org/licenses/>.

# Checks if Octave is started from a file that is a link or if this
# file has been taken directly to startup the Octave program.

if [ -L "$0" ] ; then
 ROOT="$(dirname $(readlink -f "$0"))"
else
 ROOT="$(cd "$(dirname "$0")" 2>/dev/null && pwd)"
fi
ROOT="$(dirname "${ROOT}")"

"${ROOT}/bin/octave"

# Use AppleScript to kill the icon in the dock.
# FIXME - how to replace "Octave-3.7.0+" with "Octave-$VER"
osascript 2>&1>/dev/null <<EOF
  tell application "Octave-3.7.0+"
    quit
  end tell
EOF