view darwin_files/launch_octave.sh @ 3233:36f223faf601

[Darwin] Shell script to launch and quit Octave
author Anirudha Bose <ani07nov@gmail.com>
date Tue, 24 Sep 2013 00:05:47 +0530
parents
children f9c5235c5688
line wrap: on
line source

#!/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