aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-11-29 10:18:29 +0800
committerAaron LI <aly@aaronly.me>2017-11-29 10:18:29 +0800
commit1331acf69ea16d508a4078b0ea4beded179aa831 (patch)
tree2ddb408ec52f422f7909a3c8f9b928b2c82d4ea6 /bin
parentbbf790267d5cbc3407f8464a328d26e2bf69a2bf (diff)
downloadatoolbox-1331acf69ea16d508a4078b0ea4beded179aa831.tar.bz2
Add bin/ds9: simple wrapper to show filename on ds9 title bar
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ds939
1 files changed, 39 insertions, 0 deletions
diff --git a/bin/ds9 b/bin/ds9
new file mode 100755
index 0000000..60b7d74
--- /dev/null
+++ b/bin/ds9
@@ -0,0 +1,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} "$@"