aboutsummaryrefslogtreecommitdiffstats
path: root/bin/ds9
blob: 60b7d744a4b7fe966d6f7c8f2943f9862e5c13b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/sh
#
# Copyright (c) 2017 Aaron LI
# MIT License
#
# A simple shell wrapper on SAOImage DS9 using the "-title" option
# to display the filename on the title bar by default.
#
# XXX/limitations:
# * Simply take the last argument as the filename
# * Does not work well with multiple frames
#
# 2017-11-29
#

for _ds9 in ${HOME}/local/ds9/ds9 \
            ${HOME}/local/bin/ds9 \
            /usr/local/bin/ds9 \
            /usr/bin/ds9; do
    if [ -x "${_ds9}" ]; then
        DS9="${_ds9}"
        break
    fi
done

case "$1" in
    ""|-h|--help)
        echo "usage: ${0##*/} [options] filename ..."
        echo "DS9: ${DS9}"
        exit 1
        ;;
esac

# Get the last argument as the filename shown on the title bar
# Credit: http://www.faqs.org/faqs/unix-faq/faq/part2/section-12.html
for _last; do true; done
filename="${_last}"

exec ${DS9} -title ${filename} "$@"